Platformer Pro  2.3.2
A platform game kit for Unity.
PlatformerPro.Breath Class Reference

Add this to your character (or child) if you want a breath mechanic (typically used when swimming). Breath is typically between 0 and 1, but you can increase it by setting MaxBreath. More...

Inheritance diagram for PlatformerPro.Breath:

Public Member Functions

void GainBreath (float amount)
 Gains the specified amount of breath. More...
 

Public Attributes

Movement loseBreathMovement
 If this is set lose breath only when this movement is active. More...
 
float maxBreath = 1.0f
 The max breath. We typically track breath between 0 and 1, but you can change that if you want to (for example) have a power up that increases breath. More...
 
float loseRate
 Rate at which we lose breath when we do need to hold it, per second. More...
 
float gainRate
 
DamageType damageType
 
float damageRate
 
int damageAmount
 

Protected Member Functions

virtual void Init ()
 Initialise this instance. More...
 
virtual void DoBreath ()
 Does the work for the breathing mechanism. More...
 
virtual bool HoldingBreath ()
 Are we holding our breath? More...
 
virtual void DoOutOfBreathDamage ()
 Starts doing out of breath damage unless already started. More...
 
virtual IEnumerator OutOfBreathRoutine ()
 Loops and does damage each damage tick. Stops if out of breath is false. More...
 

Protected Attributes

bool underwater
 Track if we think are underwater (used during damage to determine if we should gain or lose breath). More...
 
float breathAmount
 Current breath. More...
 
Character character
 Cached character reference. More...
 
CharacterHealth characterHealth
 Cached character health reference. More...
 
bool outOfBreath
 Tracks if we are out of breath or not. More...
 
DamageInfo damageInfo
 Cached damage info. More...
 
SpecialMovement_Swim cachedSwimMovement
 The cached loseBreathMovement as a swim movement. More...
 
bool checkForSwimMovement = true
 Tracks if we need to check for a siwm movement yet. More...
 

Properties

float CurrentBreath [get]
 Gets the raw value of the breath. More...
 
float CurrentBreathAsPercentage [get]
 Gets the current breath as percentage between 0 and 1. More...
 

Detailed Description

Add this to your character (or child) if you want a breath mechanic (typically used when swimming). Breath is typically between 0 and 1, but you can increase it by setting MaxBreath.

Member Function Documentation

◆ DoBreath()

virtual void PlatformerPro.Breath.DoBreath ( )
protectedvirtual

Does the work for the breathing mechanism.

◆ DoOutOfBreathDamage()

virtual void PlatformerPro.Breath.DoOutOfBreathDamage ( )
protectedvirtual

Starts doing out of breath damage unless already started.

◆ GainBreath()

void PlatformerPro.Breath.GainBreath ( float  amount)

Gains the specified amount of breath.

Parameters
amountAmount.

◆ HoldingBreath()

virtual bool PlatformerPro.Breath.HoldingBreath ( )
protectedvirtual

Are we holding our breath?

Returns
true, if breath was being held, false otherwise.

◆ Init()

virtual void PlatformerPro.Breath.Init ( )
protectedvirtual

Initialise this instance.

◆ OutOfBreathRoutine()

virtual IEnumerator PlatformerPro.Breath.OutOfBreathRoutine ( )
protectedvirtual

Loops and does damage each damage tick. Stops if out of breath is false.

Member Data Documentation

◆ breathAmount

float PlatformerPro.Breath.breathAmount
protected

Current breath.

◆ cachedSwimMovement

SpecialMovement_Swim PlatformerPro.Breath.cachedSwimMovement
protected

The cached loseBreathMovement as a swim movement.

◆ character

Character PlatformerPro.Breath.character
protected

Cached character reference.

◆ characterHealth

CharacterHealth PlatformerPro.Breath.characterHealth
protected

Cached character health reference.

◆ checkForSwimMovement

bool PlatformerPro.Breath.checkForSwimMovement = true
protected

Tracks if we need to check for a siwm movement yet.

◆ damageAmount

int PlatformerPro.Breath.damageAmount

◆ damageInfo

DamageInfo PlatformerPro.Breath.damageInfo
protected

Cached damage info.

◆ damageRate

float PlatformerPro.Breath.damageRate

◆ damageType

DamageType PlatformerPro.Breath.damageType

◆ gainRate

float PlatformerPro.Breath.gainRate

◆ loseBreathMovement

Movement PlatformerPro.Breath.loseBreathMovement

If this is set lose breath only when this movement is active.

◆ loseRate

float PlatformerPro.Breath.loseRate

Rate at which we lose breath when we do need to hold it, per second.

◆ maxBreath

float PlatformerPro.Breath.maxBreath = 1.0f

The max breath. We typically track breath between 0 and 1, but you can change that if you want to (for example) have a power up that increases breath.

◆ outOfBreath

bool PlatformerPro.Breath.outOfBreath
protected

Tracks if we are out of breath or not.

◆ underwater

bool PlatformerPro.Breath.underwater
protected

Track if we think are underwater (used during damage to determine if we should gain or lose breath).

Property Documentation

◆ CurrentBreath

float PlatformerPro.Breath.CurrentBreath
get

Gets the raw value of the breath.

The current breath.

◆ CurrentBreathAsPercentage

float PlatformerPro.Breath.CurrentBreathAsPercentage
get

Gets the current breath as percentage between 0 and 1.

The current breath as percentage.


The documentation for this class was generated from the following file: