TopDown Engine  v3.6
MoreMountains.TopDownEngine.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.TopDownEngine.HealthAutoRefill:
MoreMountains.TopDownEngine.TopDownMonoBehaviour MoreMountains.Tools.MMMonoBehaviour

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...
 
Health TargetHealth
 an optional target Health component to refill 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.TopDownEngine.HealthAutoRefill.Awake ( )
protectedvirtual

On Awake we do our init

◆ Initialization()

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

On init we grab our Health component

◆ OnDisable()

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

On disable we stop listening for hits

◆ OnEnable()

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

On enable we start listening for hits

◆ OnHit()

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

On hit we store our time

◆ ProcessRefillHealth()

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

Tests if a refill is needed and processes it

◆ Update()

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

On Update we refill

Member Data Documentation

◆ _health

Health MoreMountains.TopDownEngine.HealthAutoRefill._health
protected

◆ _healthToGive

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

◆ _lastBurstTimestamp

float MoreMountains.TopDownEngine.HealthAutoRefill._lastBurstTimestamp
protected

◆ _lastHitTime

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

◆ CooldownAfterHit

float MoreMountains.TopDownEngine.HealthAutoRefill.CooldownAfterHit = 1f

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

◆ DurationBetweenBursts

float MoreMountains.TopDownEngine.HealthAutoRefill.DurationBetweenBursts = 2f

the duration between two health bursts, in seconds

◆ HealthPerBurst

float MoreMountains.TopDownEngine.HealthAutoRefill.HealthPerBurst = 5

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

◆ HealthPerSecond

float MoreMountains.TopDownEngine.HealthAutoRefill.HealthPerSecond

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

◆ RefillHealth

bool MoreMountains.TopDownEngine.HealthAutoRefill.RefillHealth = true

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

◆ RefillMode

RefillModes MoreMountains.TopDownEngine.HealthAutoRefill.RefillMode

the selected refill mode

◆ TargetHealth

Health MoreMountains.TopDownEngine.HealthAutoRefill.TargetHealth

an optional target Health component to refill


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