Class CharacterHealth
Behavior class that handles health logic for character
Fields
DamageStunDuration
How many frames does the character stun when they take damage
Declaration
public readonly FrameBasedInt DamageStunDuration
InvincibleDuration
How many frames does the character's Invincibility last
Declaration
public readonly FrameBasedInt InvincibleDuration
InvincibleOnDash
Should character be invincible when dashing
Declaration
public readonly FrameBasedBool InvincibleOnDash
InvincibleOnRush
Should character be invincible when rushing
Declaration
public readonly FrameBasedBool InvincibleOnRush
KnockbackDeceleration
Movement deceleration when the character is knocking back after take damage
Declaration
public readonly FrameBasedInt KnockbackDeceleration
KnockbackSpeed
How fast should the character get knock back when they take damage
Declaration
public readonly FrameBasedInt KnockbackSpeed
MaxHP
Upper limit of the HP
Declaration
public readonly FrameBasedInt MaxHP
Properties
HP
Current health point of the character
Declaration
public int HP { get; set; }
InvincibleEndFrame
The frame when character's invincibility ends
Declaration
public int InvincibleEndFrame { get; set; }
IsEmptyHealth
True if the character have no health point
Declaration
public bool IsEmptyHealth { get; }
IsFullHealth
True if the character is full of health
Declaration
public bool IsFullHealth { get; }
IsInvincible
True if the character is currently invincible
Declaration
public bool IsInvincible { get; }
LastDamageFrame
The frame when character took damage last time
Declaration
public int LastDamageFrame { get; set; }
TakingDamage
True if the character is currently taking damage
Declaration
public bool TakingDamage { get; }
Methods
Heal(int)
Add given amount of HP for the character
Declaration
public bool Heal(int heal)
Returns
Type | Description |
---|---|
bool | True when character get healed |
MakeInvincible(int)
Let the character become invincible for given frames
Declaration
public void MakeInvincible(int duration = 1)
OnActivated()
Callback when character entity get activated
Declaration
public void OnActivated()