C# Class UnityPlatformer.CharacterHealth

Tracks character health and lives. Triggers character damage/death
Inheritance: UnityEngine.MonoBehaviour
Mostrar archivo Open project: llafuente/unity-platformer Class Usage Examples

Public Properties

Property Type Description
alignment Alignment
onDamage System.Action
onDeath System.Action
onGameOver System.Action
onHeal System.Action
onHurt HurtCallback
onImmunity System.Action
onInjured HurtCallback
onInvulnerabilityEnd System.Action
onInvulnerabilityStart System.Action
onMaxHealth System.Action
onRespawn System.Action

Public Methods

Method Description
Damage ( int amount = 1, CharacterHealth causer = null ) : bool

Try to Damage the Character triggers onDamage triggers onDeath NOTE this won't trigger onHurtCharacter

Damage ( int amount, DamageType dt, CharacterHealth causer = null ) : bool

Try to Damage the Character

Damage ( Damage dmg ) : void

Try to Damage the Character

Die ( ) : void

Disable HitBox(es) and DamageType(s) Trigger onDeath

Heal ( int amount = 1 ) : void

increse health character if possible maxHealth not reached. Trigger onMaxHealth

IsInvulnerable ( ) : bool

Character is invulnerable?

Kill ( ) : void

Kill the character even if it's invulnerable

SetInvulnerable ( float time ) : void

Turns a character invulnerable, but still can be killed using Kill NOTE use float.MaxValue for unlimited time

SetVulnerable ( ) : void

disable invulnerability

Start ( ) : void

check missconfiguration and initialization

isDead ( ) : bool

No healt

Method Details

Damage() public method

Try to Damage the Character triggers onDamage triggers onDeath NOTE this won't trigger onHurtCharacter
public Damage ( int amount = 1, CharacterHealth causer = null ) : bool
amount int
causer CharacterHealth
return bool

Damage() public method

Try to Damage the Character
public Damage ( int amount, DamageType dt, CharacterHealth causer = null ) : bool
amount int
dt DamageType
causer CharacterHealth
return bool

Damage() public method

Try to Damage the Character
public Damage ( Damage dmg ) : void
dmg Damage
return void

Die() public method

Disable HitBox(es) and DamageType(s) Trigger onDeath
public Die ( ) : void
return void

Heal() public method

increse health character if possible maxHealth not reached. Trigger onMaxHealth
public Heal ( int amount = 1 ) : void
amount int
return void

IsInvulnerable() public method

Character is invulnerable?
public IsInvulnerable ( ) : bool
return bool

Kill() public method

Kill the character even if it's invulnerable
public Kill ( ) : void
return void

SetInvulnerable() public method

Turns a character invulnerable, but still can be killed using Kill NOTE use float.MaxValue for unlimited time
public SetInvulnerable ( float time ) : void
time float
return void

SetVulnerable() public method

disable invulnerability
public SetVulnerable ( ) : void
return void

Start() public method

check missconfiguration and initialization
public Start ( ) : void
return void

isDead() public method

No healt
public isDead ( ) : bool
return bool

Property Details

alignment public_oe property

Character alignment
public Alignment alignment
return Alignment

onDamage public_oe property

Fired when character is damaged. Will be fired even it the character is inmmune
public Action,System onDamage
return System.Action

onDeath public_oe property

Play death animation, turn off the music... those sort of things
public Action,System onDeath
return System.Action

onGameOver public_oe property

Credits...
public Action,System onGameOver
return System.Action

onHeal public_oe property

Display some greenish starts floating around!
public Action,System onHeal
return System.Action

onHurt public_oe property

This Character deal damage to other dt is the Damage dealed to is the CharacterHealth hurted
public HurtCallback onHurt
return HurtCallback

onImmunity public_oe property

Fired after onDamage and Character is inmmune to given Damage
public Action,System onImmunity
return System.Action

onInjured public_oe property

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
public HurtCallback onInjured
return HurtCallback

onInvulnerabilityEnd public_oe property

Stop that funky music!
public Action,System onInvulnerabilityEnd
return System.Action

onInvulnerabilityStart public_oe property

Play that funky music! Quake-damage! NOTE this can be fired many times before onInvulnerabilityEnd
public Action,System onInvulnerabilityStart
return System.Action

onMaxHealth public_oe property

Fired when Character heal and now it's at maxHealth
public Action,System onMaxHealth
return System.Action

onRespawn public_oe property

After death when there are lives player can respawn
public Action,System onRespawn
return System.Action