Corgi Engine  v9.1
MoreMountains.CorgiEngine.HealthAutoRefill Class Reference

Add this class to a character or object with a Health class, and its health will auto refill based on the settings here More...

Inheritance diagram for MoreMountains.CorgiEngine.HealthAutoRefill:
MoreMountains.CorgiEngine.CorgiMonoBehaviour

Public Types

enum  RefillModes { RefillModes.Linear, RefillModes.Bursts }
 

Public Member Functions

virtual void OnHit ()
 On hit we store our time More...
 

Public Attributes

RefillModes RefillMode
 the selected refill mode More...
 
float CooldownAfterHit = 1f
 how much time, in seconds, should pass before the refill kicks in More...
 
bool RefillHealth = true
 if this is true, health will refill itself when not at full health More...
 
float HealthPerSecond
 the amount of health per second to restore when in linear mode More...
 
float HealthPerBurst = 5
 the amount of health to restore per burst when in burst mode More...
 
float DurationBetweenBursts = 2f
 the duration between two health bursts, in seconds More...
 

Protected Member Functions

virtual void Awake ()
 On Awake we do our init More...
 
virtual void Initialization ()
 On init we grab our Health component More...
 
virtual void Update ()
 On Update we refill More...
 
virtual void ProcessRefillHealth ()
 Tests if a refill is needed and processes it More...
 
virtual void OnEnable ()
 On enable we start listening for hits More...
 
virtual void OnDisable ()
 On disable we stop listening for hits More...
 

Protected Attributes

Health _health
 
float _lastHitTime = 0f
 
float _healthToGive = 0f
 
float _lastBurstTimestamp
 

Detailed Description

Add this class to a character or object with a Health class, and its health will auto refill based on the settings here

Member Enumeration Documentation

◆ RefillModes

the possible refill modes :

  • linear : constant health refill at a certain rate per second
  • bursts : periodic bursts of health
Enumerator
Linear 
Bursts 

Member Function Documentation

◆ Awake()

virtual void MoreMountains.CorgiEngine.HealthAutoRefill.Awake ( )
protectedvirtual

On Awake we do our init

◆ Initialization()

virtual void MoreMountains.CorgiEngine.HealthAutoRefill.Initialization ( )
protectedvirtual

On init we grab our Health component

◆ OnDisable()

virtual void MoreMountains.CorgiEngine.HealthAutoRefill.OnDisable ( )
protectedvirtual

On disable we stop listening for hits

◆ OnEnable()

virtual void MoreMountains.CorgiEngine.HealthAutoRefill.OnEnable ( )
protectedvirtual

On enable we start listening for hits

◆ OnHit()

virtual void MoreMountains.CorgiEngine.HealthAutoRefill.OnHit ( )
virtual

On hit we store our time

◆ ProcessRefillHealth()

virtual void MoreMountains.CorgiEngine.HealthAutoRefill.ProcessRefillHealth ( )
protectedvirtual

Tests if a refill is needed and processes it

◆ Update()

virtual void MoreMountains.CorgiEngine.HealthAutoRefill.Update ( )
protectedvirtual

On Update we refill

Member Data Documentation

◆ _health

Health MoreMountains.CorgiEngine.HealthAutoRefill._health
protected

◆ _healthToGive

float MoreMountains.CorgiEngine.HealthAutoRefill._healthToGive = 0f
protected

◆ _lastBurstTimestamp

float MoreMountains.CorgiEngine.HealthAutoRefill._lastBurstTimestamp
protected

◆ _lastHitTime

float MoreMountains.CorgiEngine.HealthAutoRefill._lastHitTime = 0f
protected

◆ CooldownAfterHit

float MoreMountains.CorgiEngine.HealthAutoRefill.CooldownAfterHit = 1f

how much time, in seconds, should pass before the refill kicks in

◆ DurationBetweenBursts

float MoreMountains.CorgiEngine.HealthAutoRefill.DurationBetweenBursts = 2f

the duration between two health bursts, in seconds

◆ HealthPerBurst

float MoreMountains.CorgiEngine.HealthAutoRefill.HealthPerBurst = 5

the amount of health to restore per burst when in burst mode

◆ HealthPerSecond

float MoreMountains.CorgiEngine.HealthAutoRefill.HealthPerSecond

the amount of health per second to restore when in linear mode

◆ RefillHealth

bool MoreMountains.CorgiEngine.HealthAutoRefill.RefillHealth = true

if this is true, health will refill itself when not at full health

◆ RefillMode

RefillModes MoreMountains.CorgiEngine.HealthAutoRefill.RefillMode

the selected refill mode


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