Tracks the health of an object. Also depending on configuration, it can handle automatically destroying an object when health reaches 0. Note that damage or healing should generally be dealt to Hittable component, but you can set health or max health directly from this component.
More...
Tracks the health of an object. Also depending on configuration, it can handle automatically destroying an object when health reaches 0. Note that damage or healing should generally be dealt to Hittable component, but you can set health or max health directly from this component.
◆ ChangeHealth()
void ChangeHealth |
( |
Context | instigator, |
|
|
int | delta ) |
Change the current health of this object.
- Parameters
-
instigator | The source context that is triggering this change |
delta | Positive to restore health, negative to remove health |
◆ ChangeMaxHealth()
void ChangeMaxHealth |
( |
Context | instigator, |
|
|
int | delta ) |
Adds the delta to the current maximum health.
- Parameters
-
instigator | The source context that is triggering this change |
delta | Positive to increase max health, negative to decrease it |
◆ GetHealth()
◆ GetMaxHealth()
◆ SetHealth()
void SetHealth |
( |
Context | instigator, |
|
|
int | newValue ) |
Set the current health of this object. It will always be clamped between 0 and MaxHealth.
- Parameters
-
instigator | The source context that is triggering this change |
newValue | The new value for current health |
◆ SetHealthZeroedBehavior()
void SetHealthZeroedBehavior |
( |
Context | instigator, |
|
|
int | behavior ) |
What should the object do when it's health is set to 0?
- Parameters
-
instigator | The source context that is triggering this change |
behavior | What HealthZeroedBehavior should this object use? |
◆ SetMaxHealth()
void SetMaxHealth |
( |
Context | instigator, |
|
|
int | newValue ) |
Explicitly sets the maximum health of this object.
- Parameters
-
instigator | The source context that is triggering this change |
newValue | |
◆ OnHealthChanged
Subscribe to this to get updates when this object's health changes! Broadcasts context and current health.