Class Timer
A Timer allows you to fire a UnityEvent after a certain number of seconds. Time starts to run as soon as it is enabled. A Timer can be stopped, reset, paused, and resumed. To restart a Timer after it has been stopped, you must re-enable it, at which point time will start from the beginning.
Inheritance
MonoBehaviour
Timer
Implements
IPauseable
Namespace: Alegra.DimSums
Assembly: cs.temp.dll.dll
Syntax
public class Timer : MonoBehaviour, IPauseable
Fields
duration
Time limit in seconds.
Declaration
public float duration
Field Value
Type | Description |
---|---|
System.Single |
loop
If true, the timer will run again using the same duration after it reaches the time limit.
Declaration
public bool loop
Field Value
Type | Description |
---|---|
System.Boolean |
onTimeOut
Fires once when the timer reaches the time limit.
Declaration
public UnityEvent onTimeOut
Field Value
Type | Description |
---|---|
UnityEvent |
Methods
IsPauseable()
Declaration
public bool IsPauseable()
Returns
Type | Description |
---|---|
System.Boolean |
Pause(Boolean)
Declaration
public void Pause(bool pause)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | pause |
Reset()
Restarts the timer from time 0.
Declaration
public void Reset()
Stop()
Turns the timer off by disabling it. To restart the timer, you must re-enable it.
Declaration
public void Stop()
Implements
IPauseable