Interface
HealthComp
:The health component.
group
Component Types
hurt
(n?: number): voidDecrease HP by n (defaults to 1).
heal
(n?: number): voidIncrease HP by n (defaults to 1).
hp
(): numberCurrent health points.
setHP
(hp: number): voidSet current health points.
maxHP
(): number | nullMax amount of HP.
setMaxHP
(hp: number): voidSet max amount of HP.
onHurt
(action: (amount?: number) => void): KEventControllerRegister an event that runs when hurt() is called upon the object.
since
v2000.1
onHeal
(action: (amount?: number) => void): KEventControllerRegister an event that runs when heal() is called upon the object.
since
v2000.1
onDeath
(action: () => void): KEventControllerRegister an event that runs when object's HP is equal or below 0.
since
v2000.1