5#include "CoreMinimal.h"
6#include "UObject/Interface.h"
7#include "HealthInterface.generated.h"
11DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FDamageSignature,
class AActor*, Victim,
const float, Damage,
struct FDamageEvent
const&, DamageEvent,
const class AController*, EventInstigator,
const class AActor*, DamageCauser,
const class APlayerState*, InstigatorPlayerState);
15DECLARE_DYNAMIC_DELEGATE_SixParams(FBPDamageSignature,
class AActor*, Victim,
const float, Damage,
struct FDamageEvent
const&, DamageEvent,
const class AController*, EventInstigator,
const class AActor*, DamageCauser,
const class APlayerState*, InstigatorPlayerState);
17class UAfflictionComponent;
19#define RECENT_DAMAGE_TIME 10.0f
21UINTERFACE(BlueprintType,meta=(CannotImplementInterfaceInBlueprint))
24 GENERATED_UINTERFACE_BODY()
29 GENERATED_IINTERFACE_BODY()
40 UFUNCTION(BlueprintCallable, Category = HealthInterface)
41 virtual
bool IsArmored()
const {
return false; }
42 UFUNCTION(BlueprintCallable, Category = HealthInterface)
43 virtual
void SetDamageResistance(
float NewValue) {}
44 UFUNCTION(BlueprintCallable, Category = HealthInterface)
45 virtual
void SetExplosiveDamageResistance(
float NewValue) {}
46 UFUNCTION(BlueprintCallable, Category = HealthInterface)
47 virtual
float GetDamageResistance()
const {
return 1.0f; };
48 UFUNCTION(BlueprintCallable, Category = HealthInterface)
49 virtual
float GetExplosiveDamageResistance()
const {
return 1.0f; };
50 UFUNCTION(BlueprintCallable, Category = HealthInterface)
51 virtual bool AreShieldsFull()
const;
52 UFUNCTION(BlueprintCallable, Category = HealthInterface)
53 virtual bool AreShieldsOvercharged()
const;
54 UFUNCTION(BlueprintCallable, Category = HealthInterface)
55 virtual float GetShields()
const;
56 UFUNCTION(BlueprintCallable, Category = HealthInterface)
57 virtual float GetMaxShields()
const;
58 UFUNCTION(BlueprintCallable, Category = HealthInterface)
59 virtual
float GetCachedMaxShields()
const {
return GetMaxShields(); };
60 UFUNCTION(BlueprintCallable, Category = HealthInterface)
61 virtual float GetMaxShieldsWithOvercharge()
const;
62 UFUNCTION(BlueprintCallable, Category = HealthInterface)
63 virtual float GetPercentShields()
const;
64 UFUNCTION(BlueprintCallable, Category = HealthInterface)
65 virtual float GetPercentOverchargedShields()
const;
66 UFUNCTION(BlueprintCallable, Category = HealthInterface)
67 virtual bool HasShields()
const;
68 UFUNCTION(BlueprintCallable, Category = HealthInterface)
69 virtual bool HasShieldsThatNeedRecharging()
const;
70 UFUNCTION(BlueprintCallable, Category = HealthInterface)
71 virtual bool IsHealthFull()
const;
72 UFUNCTION(BlueprintCallable, Category = HealthInterface)
73 virtual float GetHealth()
const;
74 UFUNCTION(BlueprintCallable, Category = HealthInterface)
75 virtual float GetMaxHealth()
const;
76 UFUNCTION(BlueprintCallable, Category = HealthInterface)
77 virtual
float GetCachedMaxHealth()
const {
return GetMaxHealth(); }
78 UFUNCTION(BlueprintCallable, Category = HealthInterface)
79 virtual
float GetCachedOvershield()
const {
return GetOvershield(); }
80 UFUNCTION(BlueprintCallable, Category = HealthInterface)
81 virtual float GetPercentHealth()
const;
82 UFUNCTION(BlueprintCallable, Category = HealthInterface)
83 virtual float GetOvershield()
const;
84 UFUNCTION(BlueprintCallable, Category = HealthInterface)
85 virtual
float GetHealthPickupModifier()
const {
return 1.0f;}
86 UFUNCTION(BlueprintCallable, Category = HealthInterface)
87 virtual
bool IsUsingPassiveShieldRegen()
const {
return true;}
88 UFUNCTION(BlueprintCallable, Category = HealthInterface)
89 virtual bool IsDead()
const;
90 UFUNCTION(BlueprintCallable, Category = HealthInterface)
91 virtual
bool CanBeRepaired(const AActor* RepairInstigator)
const {
return false;}
92 UFUNCTION(BlueprintCallable, Category = HealthInterface)
93 virtual bool IsHealthWithinGivenPercentage(
float TargetPercentage,
bool bCheckForLessThanPercentage =
true)
const;
94 UFUNCTION(BlueprintCallable, Category = HealthInterface)
95 virtual void RemoveOverchargedShields();
97 UFUNCTION(BlueprintCallable, Category = HealthInterface)
98 virtual void ModifyShieldsThenHealth(
float Delta);
100 UFUNCTION(BlueprintCallable, Category = HealthInterface)
101 virtual
void SetShields(
float InShields) { }
102 UFUNCTION(BlueprintCallable, Category = HealthInterface)
103 virtual
void SetMaxShields(const
float NewMaxHealth) { }
104 UFUNCTION(BlueprintCallable, Category = HealthInterface)
105 virtual void ModifyShields(
float Delta,
bool bCanOvercharge =
false);
106 UFUNCTION(BlueprintCallable, Category = HealthInterface)
107 virtual
bool CanModifyShieldsPastOverchargeMark()
const {
return false; }
108 UFUNCTION(BlueprintCallable, Category = HealthInterface)
109 virtual
void SetCanModifyShieldsPastOverchargeMark(
bool bNewCanOverchargeShields) {}
110 UFUNCTION(BlueprintCallable, Category = HealthInterface)
111 virtual
void SetShieldRegenRate(
float NewRate) { }
112 UFUNCTION(BlueprintCallable, Category = HealthInterface)
113 virtual
void SetOvershield(
float NewOvershield){}
114 UFUNCTION(BlueprintCallable, Category = HealthInterface)
115 virtual
void SetHealth(
float InHealth) { }
116 UFUNCTION(BlueprintCallable, Category = HealthInterface)
117 virtual
void SetMaxHealth(const
float NewMaxHealth) { }
118 UFUNCTION(BlueprintCallable, Category = HealthInterface)
119 virtual void ModifyHealth(
float Delta);
120 UFUNCTION(BlueprintCallable, Category = HealthInterface)
121 virtual
void SetHealthRegenRate(
float NewRate) { }
122 UFUNCTION(BlueprintCallable, Category =HealthInterface)
123 virtual
void SetHealthPickupModifier(
float NewModifier) { }
124 UFUNCTION(BlueprintCallable, Category = HealthInterface)
125 virtual float GetTotalPercentHealth()
const;
126 UFUNCTION(BlueprintCallable, Category = HealthInterface)
128 UFUNCTION(BlueprintCallable, Category = HealthInterface)
129 virtual
bool HasRecentlyTakenDamage()
const {
return GetTimeSinceLastDamage() <
RECENT_DAMAGE_TIME; }
130 UFUNCTION(BlueprintCallable, Category = HealthInterface)
131 virtual
void SetShieldAndHealthRegenRate(
float NewRate) { }
132 UFUNCTION(BlueprintCallable, Category = HealthInterface)
133 virtual
void SetCanUsePassiveShieldRegen(
bool bNewUsePassiveShieldRegen){}
134 UFUNCTION(BlueprintCallable, Category = HealthInterface)
135 virtual
bool GetCachedUsesPassiveShieldRegen()
const {
return true;}
136 UFUNCTION(BlueprintCallable, Category = HealthInterface)
137 virtual UAfflictionComponent* GetAfflictionComponent()
const {
return NULL; }
140 UFUNCTION(Category =
"HealthInterface Events")
141 virtual FDamageSignature& GetDeathEvent() {
return PawnInterfaceDeathEvent; }
143 UFUNCTION(Category =
"HealthInterface Events")
144 virtual FDamageSignature& GetDamageEvent() {
return PawnInterfaceDamageEvent; }
145 UFUNCTION(Category =
"HealthInterface Events")
146 virtual FHealedSignature& GetHealedEvent() {
return PawnInterfaceHealedEvent; }
147 UFUNCTION(Category =
"HealthInterface Events")
148 virtual FHealedSignature& GetShieldsRepairedEvent() {
return PawnInterfaceShieldsRepairedEvent; }
149 UFUNCTION(Category =
"HealthInterface Events")
150 virtual FHealthChangedSignature& GetHealthChangedEvent() {
return PawnInterfaceHealthChangedEvent; }
151 UFUNCTION(Category =
"HealthInterface Events")
152 virtual FHealthChangedSignature& GetShieldsChangedEvent() {
return PawnInterfaceShieldshangedEvent; }
153 UFUNCTION(Category =
"HealthInterface Events")
154 virtual FHealthChangedSignature& GetShieldsDepletedEvent() {
return PawnInterfaceShieldDepletedEvent; }
157 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
158 virtual
void BindToDeathEvent(const FBPDamageSignature& Event) { PawnInterfaceDeathEvent.Add(Event); }
159 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
160 virtual
void BindToDamageEvent(const FBPDamageSignature& Event) { PawnInterfaceDamageEvent.Add(Event); }
161 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
162 virtual
void BindToHealedEvent(const FBPHealedSignature& Event) { PawnInterfaceHealedEvent.Add(Event); }
163 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
164 virtual
void BindToShieldsRepairedEvent(const FBPHealedSignature& Event) { PawnInterfaceShieldsRepairedEvent.Add(Event); }
165 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
166 virtual
void BindToHealthChangedEvent(const FBPHealthChangedSignature& Event) { PawnInterfaceHealthChangedEvent.Add(Event); }
167 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
168 virtual
void BindToShieldsChangedEvent(const FBPHealthChangedSignature& Event) { PawnInterfaceShieldshangedEvent.Add(Event); }
169 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
170 virtual
void BindToShieldsDepletedEvent(const FBPHealthChangedSignature& Event) { PawnInterfaceShieldDepletedEvent.Add(Event); }
172 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
173 virtual
void UnbindDeathEvent(const FBPDamageSignature& Event) { PawnInterfaceDeathEvent.Remove(Event); }
174 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
175 virtual
void UnbindDamageEvent(const FBPDamageSignature& Event) { PawnInterfaceDamageEvent.Remove(Event); }
176 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
177 virtual
void UnbindHealedEvent(const FBPHealedSignature& Event) { PawnInterfaceHealedEvent.Remove(Event); }
178 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
179 virtual
void UnbindShieldsRepairedEvent(const FBPHealedSignature& Event) { PawnInterfaceShieldsRepairedEvent.Remove(Event); }
180 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
181 virtual
void UnbindHealthChangedEvent(const FBPHealthChangedSignature& Event) { PawnInterfaceHealthChangedEvent.Remove(Event); }
182 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
183 virtual
void UnbindShieldsChangedEvent(const FBPHealthChangedSignature& Event) { PawnInterfaceShieldshangedEvent.Remove(Event); }
184 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
185 virtual
void UnbindShieldsDepletedEvent(const FBPHealthChangedSignature& Event) { PawnInterfaceShieldDepletedEvent.Remove(Event); }
187 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
188 virtual
void ClearAllToDeathEvents() { PawnInterfaceDeathEvent.Clear(); }
189 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
190 virtual
void ClearAllDamageEvents() { PawnInterfaceDamageEvent.Clear(); }
191 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
192 virtual
void ClearAllHealedEvents() { PawnInterfaceHealedEvent.Clear(); }
193 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
194 virtual
void ClearAllShieldsRepairedEvents() { PawnInterfaceShieldsRepairedEvent.Clear(); }
195 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
196 virtual
void ClearAllHealthChangedEvents() { PawnInterfaceHealthChangedEvent.Clear(); }
197 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
198 virtual
void ClearAllShieldsChangedEvents() { PawnInterfaceShieldshangedEvent.Clear(); }
199 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
200 virtual
void ClearAllShieldsDepletedEvents() { PawnInterfaceShieldDepletedEvent.Clear(); }
202 UFUNCTION(BlueprintCallable, Category =
"HealthInterface Events")
203 virtual
bool BlocksExplosions()
const {
return false; }
DECLARE_DYNAMIC_MULTICAST_DELEGATE_ThreeParams(FHealedSignature, const float, Amount, const float, Health, const bool, bFromPassiveRegen)
DECLARE_DYNAMIC_DELEGATE_OneParam(FBPHealthChangedSignature, float, Delta)
#define RECENT_DAMAGE_TIME
Definition: HealthInterface.h:19
DECLARE_DYNAMIC_DELEGATE_SixParams(FBPDamageSignature, class AActor *, Victim, const float, Damage, struct FDamageEvent const &, DamageEvent, const class AController *, EventInstigator, const class AActor *, DamageCauser, const class APlayerState *, InstigatorPlayerState)
DECLARE_DYNAMIC_DELEGATE_ThreeParams(FBPHealedSignature, const float, Amount, const float, Health, const bool, bFromPassiveRegen)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_SixParams(FDamageSignature, class AActor *, Victim, const float, Damage, struct FDamageEvent const &, DamageEvent, const class AController *, EventInstigator, const class AActor *, DamageCauser, const class APlayerState *, InstigatorPlayerState)
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FHealthChangedSignature, float, Delta)
Definition: HealthInterface.h:28
FDamageSignature PawnInterfaceDeathEvent
Definition: HealthInterface.h:32
FHealthChangedSignature PawnInterfaceShieldDepletedEvent
Definition: HealthInterface.h:38
FHealthChangedSignature PawnInterfaceHealthChangedEvent
Definition: HealthInterface.h:36
FHealedSignature PawnInterfaceHealedEvent
Definition: HealthInterface.h:34
FHealthChangedSignature PawnInterfaceShieldshangedEvent
Definition: HealthInterface.h:37
FHealedSignature PawnInterfaceShieldsRepairedEvent
Definition: HealthInterface.h:35
FDamageSignature PawnInterfaceDamageEvent
Definition: HealthInterface.h:33
Definition: HealthInterface.h:23