This is a simple script for tracking characters health. It provides a Damage method and a
More...
Inherits MonoBehaviour.
|
| virtual void | Die () |
| | Call this to kill the character. More...
|
| |
| virtual void | Damage (int amount) |
| | Damage the character the specified amount. More...
|
| |
| void | FallDamage (float amount) |
| | Call this to calculate and apply fall damage. More...
|
| |
|
|
int | health |
| |
|
float | invulnerableTimer |
| |
This is a simple script for tracking characters health. It provides a Damage method and a
| virtual void SimpleHealth.Damage |
( |
int |
amount) | |
|
|
virtual |
Damage the character the specified amount.
- Parameters
-
| amount | Amount of damage to cause. |
| virtual void SimpleHealth.Die |
( |
) | |
|
|
virtual |
Call this to kill the character.
| IEnumerator SimpleHealth.DoZeroHealthAction |
( |
) | |
|
|
protected |
Triggers the death actions.
- Returns
- The zero health action.
| void SimpleHealth.FallDamage |
( |
float |
amount) | |
|
Call this to calculate and apply fall damage.
- Parameters
-
| amount | Amount of fall damage, ignored if fall damage is constant. |
| float SimpleHealth.dieDelay = 1.0f |
How long before we call the Die method.
| float SimpleHealth.fallDamageAmount |
| bool SimpleHealth.fallDamageIsConstant |
If true the character will get the same amount of fall damage regardless of how far they fall.
Link to the SimpleHealthBar script that can be used to show health.
| float SimpleHealth.invulnerableTime |
After being hit you are invulnerable for this long before you can take another hit. Should usually be larger than stun time.
| int SimpleHealth.maxHealth = 10 |
| float SimpleHealth.stunTime = 1f |
Stun the character after hit for this long. During stun you can't move.
| ZeroHealthAction SimpleHealth.zeroHealthAction |
What happens when health gets to zero?
Gets the health.
The health.
| float SimpleHealth.HealthAsPercentage |
|
get |
Gets the health as apercentage. Note percentage value of 0.0f to 1.0f is used, so that the percentage can be easily used in calculations.
The health as percentage.
| bool SimpleHealth.IsInvulnerable |
|
get |
Returns true if this character is invulnerable.
| int SimpleHealth.MaxHealth |
|
get |
Gets the max health.
The max health.
The documentation for this class was generated from the following file:
- /Users/john/Desktop/PC3.5Test/Assets/2DPlatformController/Scripts/ExtraFeatures/SimpleHealth.cs