2D Platform Controller  v1.7.0
Autogenerated code documentation for the 2D Platform Controller.
 All Classes Functions Variables Properties
SimpleHealth Class Reference

This is a simple script for tracking characters health. It provides a Damage method and a More...

Inherits MonoBehaviour.

Public Member Functions

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...
 

Public Attributes

RaycastCharacterController controller
 The controller. More...
 
int maxHealth = 10
 The max health. More...
 
ZeroHealthAction zeroHealthAction
 What happens when health gets to zero? More...
 
SimpleHealthBarUI healthBar
 Link to the SimpleHealthBar script that can be used to show health. More...
 
float fallDamageAmount
 The fall damage amount. More...
 
bool fallDamageIsConstant
 If true the character will get the same amount of fall damage regardless of how far they fall. More...
 
float stunTime = 1f
 Stun the character after hit for this long. During stun you can't move. More...
 
float dieDelay = 1.0f
 How long before we call the Die method. More...
 
float invulnerableTime
 After being hit you are invulnerable for this long before you can take another hit. Should usually be larger than stun time. More...
 

Protected Member Functions

IEnumerator DoZeroHealthAction ()
 Triggers the death actions. More...
 

Protected Attributes

int health
 
float invulnerableTimer
 

Properties

int Health [get]
 Gets the health. More...
 
int MaxHealth [get]
 Gets the max health. More...
 
float 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. More...
 
bool IsInvulnerable [get]
 Returns true if this character is invulnerable. More...
 

Detailed Description

This is a simple script for tracking characters health. It provides a Damage method and a

Member Function Documentation

virtual void SimpleHealth.Damage ( int  amount)
virtual

Damage the character the specified amount.

Parameters
amountAmount 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
amountAmount of fall damage, ignored if fall damage is constant.

Member Data Documentation

RaycastCharacterController SimpleHealth.controller

The controller.

float SimpleHealth.dieDelay = 1.0f

How long before we call the Die method.

float SimpleHealth.fallDamageAmount

The fall damage amount.

bool SimpleHealth.fallDamageIsConstant

If true the character will get the same amount of fall damage regardless of how far they fall.

SimpleHealthBarUI SimpleHealth.healthBar

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

The max health.

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?

Property Documentation

int SimpleHealth.Health
get

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: