UnityUtilities
|
A base version for properties based on Countdown. More...
Public Member Functions | |||
CountdownProperty (bool loop) | |||
Empty constructor for the editor. More... | |||
void | OnBeforeSerialize () | ||
Called before the serialization (reading the editor value) of the "time" property happens. It's empty and just here because ISerializationCallbackReceiver needs it. More... | |||
void | OnAfterDeserialize () | ||
Called after the serialization (reading the editor value) of the "time" property happens. If the timer is not initialized yet, it will be here. More... | |||
Public Member Functions inherited from UnityUtilities.Countdown | |||
Countdown (bool loop) | |||
Creates a new countdown with no TotalTime duration set yet.
| |||
Countdown (bool loop, float startDuration) | |||
Creates a new countdown, starting at startDuration. More... | |||
Countdown (bool loop, Func< float > calculateDurationDelegate, float? startDuration=null) | |||
Creates a new countdown with a delegate specifying how long it should take. More... | |||
bool | Progress (float? deltaTime=null) | ||
Progresses the countdown by deltaTime (or Time.deltaTime). Returns true if the countdown it reached zero this frame. If the countdown is already at zero when this is called and Loop is true, it is restarted automatically. More... | |||
void | Reset () | ||
Resets the countdown to TotalTime. If a CalculateDurationDelegate is supplied, a new TotalTime is picked first. More... | |||
void | Reset (float timeLeft) | ||
Sets the Duration and the TimeLeft. More... | |||
void | Refill () | ||
Loops the countdown by adding TotalTime to TimeLeft. This should only be called when TimeLeft is already zero or less. If a CalculateDurationDelegate is supplied, a new TotalTime is picked first. More... | |||
void | Refill (float newTotalTimeLeft) | ||
Loops the countdown by settings TotalTime to newTotalTimeLeft and then adds it to TimeLeft. More... | |||
Additional Inherited Members | |
Properties inherited from UnityUtilities.Countdown | |
float | TimeLeft [get, set] |
The time left at the current countdown. More... | |
float | Duration [get] |
The initial duration set. More... | |
Func< float > | CalculateDurationDelegate [get, set] |
A delegate for automatically providing a new duration when the time left runs out. More... | |
bool | Loop [get, set] |
Should the countdown automatically loop when it reaches zero? More... | |
bool | ReachedZero [get] |
Returns true when the countdown reached zero (or less). More... | |
bool | IsRunning [get] |
Returns true if the countdown is currently over zero. More... | |
float | TimePassed [get] |
Returns the time passed for this countdown: (TotalTime-TimeLeft). More... | |
float | PercentElapsed [get] |
Returns 0 when the countdown is just starting and 1 when it is elapsed. If TotalTime is 0, this returns 1. More... | |
float | PercentLeft [get] |
Returns 1 when the countdown is just starting and 0 when it is elapsed. If TotalTime is 0, this returns 0. More... | |
A base version for properties based on Countdown.
UnityUtilities.CountdownProperty.CountdownProperty | ( | bool | loop | ) |
Empty constructor for the editor.
void UnityUtilities.CountdownProperty.OnAfterDeserialize | ( | ) |
Called after the serialization (reading the editor value) of the "time" property happens. If the timer is not initialized yet, it will be here.
void UnityUtilities.CountdownProperty.OnBeforeSerialize | ( | ) |
Called before the serialization (reading the editor value) of the "time" property happens. It's empty and just here because ISerializationCallbackReceiver needs it.