platformer
|
Tracks character health and lives. More...
Public Member Functions | |
delegate void | HurtCallback (Damage dt, CharacterHealth to) |
Callback type for onHurt More... | |
void | Start () |
check missconfiguration and initialization More... | |
void | SetInvulnerable (float time) |
Turns a character invulnerable, but still can be killed using Kill More... | |
void | SetVulnerable () |
disable invulnerability More... | |
bool | IsInvulnerable () |
Character is invulnerable? More... | |
void | Kill () |
Kill the character even if it's invulnerable More... | |
void | Damage (Damage dmg) |
Try to Damage the Character More... | |
bool | Damage (int amount, DamageType dt, CharacterHealth causer=null) |
Try to Damage the Character More... | |
bool | Damage (int amount=1, CharacterHealth causer=null) |
Try to Damage the Character More... | |
bool | isDead () |
No healt More... | |
void | Heal (int amount=1) |
increse health character if possible maxHealth not reached. Trigger onMaxHealth More... | |
void | DisableAllHitBoxes () |
void | Die () |
Disable HitBox(es) and DamageType(s) Trigger onDeath More... | |
Public Attributes | |
Alignment | alignment = Alignment.None |
Character alignment More... | |
bool | friendlyFire = false |
Can recieve Damage from friends (same alignment) More... | |
int | startingHealth = 1 |
Health the character will have when game starts More... | |
int | maxHealth = 1 |
Maximum health (-1 no maximum). NOTE if startingHealth == maxHealth will trigger onMaxHealth on Start. More... | |
int | startingLives = 1 |
Lives the character starts with (-1 no lives) More... | |
int | maxLives = 1 |
Maximum lives of the character. 2,147,483,647 is the maximum :) More... | |
float | invulnerabilityTimeAfterDamage = 2.0f |
After any Damage how much time the character will be invulnerable to any Damage (0 to disable) More... | |
DamageType | immunity = 0 |
List of damages that are ignored More... | |
Action | onMaxHealth |
Fired when Character heal and now it's at maxHealth More... | |
Action | onDamage |
Fired when character is damaged. More... | |
Action | onImmunity |
Fired after onDamage and Character is inmmune to given Damage More... | |
HurtCallback | onInjured |
This Character health is reduced, will fire after onDamage More... | |
HurtCallback | onHurt |
This Character deal damage to other More... | |
Action | onHeal |
Display some greenish starts floating around! More... | |
Action | onDeath |
Play death animation, turn off the music... those sort of things More... | |
Action | onGameOver |
Credits... More... | |
Action | onInvulnerabilityStart |
Play that funky music! Quake-damage! More... | |
Action | onInvulnerabilityEnd |
Stop that funky music! More... | |
Action | onRespawn |
After death when there are lives player can respawn More... | |
int | health = 0 |
Character health More... | |
int | lives = 0 |
Character lives More... | |
Character | character |
Character owner of this CharacterHealth More... | |
Tracks character health and lives.
Triggers character damage/death
|
inline |
|
inline |
|
inline |
Disable HitBox(es) and DamageType(s) Trigger onDeath
|
inline |
increse health character if possible maxHealth not reached. Trigger onMaxHealth
delegate void UnityPlatformer.CharacterHealth.HurtCallback | ( | Damage | dt, |
CharacterHealth | to | ||
) |
Callback type for onHurt
|
inline |
No healt
|
inline |
Character is invulnerable?
|
inline |
Kill the character even if it's invulnerable
|
inline |
Turns a character invulnerable, but still can be killed using Kill
NOTE use float.MaxValue for unlimited time
|
inline |
disable invulnerability
|
inline |
check missconfiguration and initialization
Character UnityPlatformer.CharacterHealth.character |
Character owner of this CharacterHealth
bool UnityPlatformer.CharacterHealth.friendlyFire = false |
Can recieve Damage from friends (same alignment)
int UnityPlatformer.CharacterHealth.health = 0 |
Character health
DamageType UnityPlatformer.CharacterHealth.immunity = 0 |
List of damages that are ignored
NOTE: this can give your character super powers! use it with caution!
float UnityPlatformer.CharacterHealth.invulnerabilityTimeAfterDamage = 2.0f |
int UnityPlatformer.CharacterHealth.lives = 0 |
Character lives
int UnityPlatformer.CharacterHealth.maxHealth = 1 |
Maximum health (-1 no maximum). NOTE if startingHealth == maxHealth will trigger onMaxHealth on Start.
int UnityPlatformer.CharacterHealth.maxLives = 1 |
Maximum lives of the character. 2,147,483,647 is the maximum :)
Action UnityPlatformer.CharacterHealth.onDamage |
Fired when character is damaged.
Will be fired even it the character is inmmune
Action UnityPlatformer.CharacterHealth.onDeath |
Play death animation, turn off the music... those sort of things
Action UnityPlatformer.CharacterHealth.onGameOver |
Credits...
Action UnityPlatformer.CharacterHealth.onHeal |
Display some greenish starts floating around!
HurtCallback UnityPlatformer.CharacterHealth.onHurt |
This Character deal damage to other
dt is the Damage dealed to is the CharacterHealth hurted
Action UnityPlatformer.CharacterHealth.onImmunity |
HurtCallback UnityPlatformer.CharacterHealth.onInjured |
This Character health is reduced, will fire after onDamage
dt is the Damage dealed to is the CharacterHealth that hurt me, if possible, could be null
Action UnityPlatformer.CharacterHealth.onInvulnerabilityEnd |
Stop that funky music!
Action UnityPlatformer.CharacterHealth.onInvulnerabilityStart |
Play that funky music! Quake-damage!
NOTE this can be fired many times before onInvulnerabilityEnd
Action UnityPlatformer.CharacterHealth.onMaxHealth |
Fired when Character heal and now it's at maxHealth
Action UnityPlatformer.CharacterHealth.onRespawn |
After death when there are lives player can respawn
int UnityPlatformer.CharacterHealth.startingHealth = 1 |
Health the character will have when game starts
int UnityPlatformer.CharacterHealth.startingLives = 1 |
Lives the character starts with (-1 no lives)