LEAP Documentation 40220
Documentation for the LEAP project
PainCausingComponent.h
Go to the documentation of this file.
1// Copyright Blue Isle Studios Inc 2018. All Rights Reserved.
2
3#pragma once
4
5#include "CoreMinimal.h"
6#include "Components/BoxComponent.h"
7#include "PainCausingComponent.generated.h"
8
9UCLASS(ClassGroup = (Custom), meta = (BlueprintSpawnableComponent))
10class PROJECTX_API UPainCausingComponent : public UBoxComponent
11{
12 GENERATED_BODY()
13
14public:
15 /* How often should this component deal damage (seconds)? */
16 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = PainCausingVolume, meta = (ClampMin = 0.01, ClampMax = 10.0))
17 float DamageTickInterval = 1.0f;
18 /* How much damage to deal */
19 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = PainCausingVolume)
20 float DamageAmount = 1.0f;
21 /* Deal damage instantly when a character enters */
22 UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = PainCausingVolume)
23 bool bDamageInstantly = true;
24
25 virtual void TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction);
26
27private:
28 TArray<class APawn*> Pawns;
29
30 UPainCausingComponent();
31
32 UFUNCTION()
33 void AddPainActor(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex, bool bFromSweep, const FHitResult& SweepResult);
34 UFUNCTION()
35 void RemovePainActor(UPrimitiveComponent* OverlappedComponent, AActor* OtherActor, UPrimitiveComponent* OtherComp, int32 OtherBodyIndex);
36};