A class in Root.Township, the global namespace.
A plain component that fires a TransformEvent once, or every interval seconds when repeating. Runs locally on whichever side has it, with no networking or saving.
Constructors
| Member | What it is |
|---|
TimedEvent() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
7 private and internal fields
| Member | What it is |
|---|
private bool btnPlay | Inspector button that calls Begin from OnValidate. |
private bool btnStop | Inspector button that calls Stop from OnValidate. |
private float interval | Seconds between repeats. Only shown when isRepeating is ticked. |
private bool isRepeating | When true, Begin keeps firing every interval seconds instead of once. |
private bool isRunningOnAwake | When true, Begin is called in Awake. |
private Coroutine repeat | The running repeat coroutine, or null. |
private TransformEvent runHere | Event invoked with this object's transform each time the timer fires. |
Methods
| Member | What it is |
|---|
void Begin() | Fires runHere once, or starts the repeat coroutine when isRepeating is set (restarting it if already running). |
void Stop() | Stops the repeat coroutine if one is running. |
3 private and internal methods
| Member | What it is |
|---|
private void Awake() | Stops any running repeat, then calls Begin if isRunningOnAwake is set. |
private void OnValidate() | Editor hook: ticking the Play or Stop inspector buttons calls Begin or Stop. |
private IEnumerator RepeatRun() (iterator) | Coroutine that invokes runHere with this transform, then waits interval seconds, forever. |