|  | Inventory Engine v4.2
    | 
A class to handle cooldown related properties and their resource consumption over time Remember to initialize it (once) and update it every frame from another class. More...
| Public Types | |
| enum | CooldownStates { Idle , Consuming , Stopped , Refilling } | 
| all possible states for the object  More... | |
| Public Member Functions | |
| delegate void | OnStateChangeDelegate (CooldownStates newState) | 
| A public delegate you can listen to for state changes. | |
| virtual void | Initialization () | 
| An init method that ensures the object is reset. | |
| virtual void | Start () | 
| Starts consuming the cooldown object if possible. | |
| virtual bool | Ready () | 
| Returns true if the cooldown is ready to be consumed, false otherwise. | |
| virtual void | Stop () | 
| Stops consuming the object. | |
| virtual void | Update () | 
| Processes the object's state machine. | |
| Public Attributes | |
| bool | Unlimited = false | 
| if this is true, the cooldown won't do anything | |
| float | ConsumptionDuration = 2f | 
| the time it takes, in seconds, to consume the object | |
| float | PauseOnEmptyDuration = 1f | 
| the pause to apply before refilling once the object's been depleted | |
| float | RefillDuration = 1f | 
| the duration of the refill, in seconds, if uninterrupted | |
| bool | CanInterruptRefill = true | 
| whether or not the refill can be interrupted by a new Start instruction | |
| CooldownStates | CooldownState = CooldownStates.Idle | 
| the current state of the object | |
| float | CurrentDurationLeft | 
| the amount of duration left in the object at any given time | |
| OnStateChangeDelegate | OnStateChange | 
| Protected Member Functions | |
| virtual void | ChangeState (CooldownStates newState) | 
| Changes the current state of the cooldown and invokes the delegate if needed. | |
| Protected Attributes | |
| float | _emptyReachedTimestamp = 0f | 
| Properties | |
| float | Progress  [get] | 
A class to handle cooldown related properties and their resource consumption over time Remember to initialize it (once) and update it every frame from another class.
| 
 | protectedvirtual | 
Changes the current state of the cooldown and invokes the delegate if needed.
| newState | 
| 
 | virtual | 
An init method that ensures the object is reset.
| delegate void MoreMountains.Tools.MMCooldown.OnStateChangeDelegate | ( | CooldownStates | newState | ) | 
A public delegate you can listen to for state changes.
How to use :
private void OnCooldownStateChange(MMCooldown.CooldownStates newState) { if (newState == MMCooldown.CooldownStates.Stopped) { // do something } }
private void OnEnable() { Cooldown.OnStateChange += OnCooldownStateChange; } 
 private void OnDisable() { Cooldown.OnStateChange -= OnCooldownStateChange; } 
| 
 | virtual | 
Returns true if the cooldown is ready to be consumed, false otherwise.
| 
 | virtual | 
Starts consuming the cooldown object if possible.
| 
 | virtual | 
Stops consuming the object.
| 
 | virtual | 
Processes the object's state machine.
| 
 | protected | 
| bool MoreMountains.Tools.MMCooldown.CanInterruptRefill = true | 
whether or not the refill can be interrupted by a new Start instruction
| float MoreMountains.Tools.MMCooldown.ConsumptionDuration = 2f | 
the time it takes, in seconds, to consume the object
| CooldownStates MoreMountains.Tools.MMCooldown.CooldownState = CooldownStates.Idle | 
the current state of the object
| float MoreMountains.Tools.MMCooldown.CurrentDurationLeft | 
the amount of duration left in the object at any given time
| OnStateChangeDelegate MoreMountains.Tools.MMCooldown.OnStateChange | 
| float MoreMountains.Tools.MMCooldown.PauseOnEmptyDuration = 1f | 
the pause to apply before refilling once the object's been depleted
| float MoreMountains.Tools.MMCooldown.RefillDuration = 1f | 
the duration of the refill, in seconds, if uninterrupted
| bool MoreMountains.Tools.MMCooldown.Unlimited = false | 
if this is true, the cooldown won't do anything
| 
 | get |