Interface
HealthComp
:The health component.
group
Component Types
hp
: numberCurrent health points. Setting it to a lower or higher value will trigger onHurt() and onHeal(). Setting it to a value greater than maxHP will set it to maxHP. Setting it to a value less than 0 will set it to 0 and trigger onDeath().
maxHP
: numberMax amount of HP.
dead
: booleanWhether hp is 0.
onHurt
(action: (deltaHP?: number) => void): KEventControllerRegister an event that runs when the hp is lowered.
since
v2000.1
onHeal
(action: (deltaHP?: number) => void): KEventControllerRegister an event that runs when the hp is increased.
since
v2000.1
onDeath
(action: () => void): KEventControllerRegister an event that runs when object's HP becomes zero.
since
v2000.1