public Timer CreateTimer(float waitTime, Timer.OnTimerFinished onTimerFinished = null, Timer.OnTimerTicked onTimerTicked = null) { timers.Add(new Timer(waitTime, onTimerFinished, onTimerTicked)); return(timers[timers.Count - 1]); }
/// <summary> /// Creates a new timer. If startNow is set to true, it will automatically start the countdown. If not you will have to call Start(). /// If you don't want to use one of the delegates (for example the onTimerFinished) you can just pass null to it. /// </summary> public static Timer CreateTimer(float waitTime, Timer.OnTimerFinished onTimerFinished = null, Timer.OnTimerTicked onTimerTicked = null, bool startNow = true) { Debug.Log("Creating SimpleTimer"); timers.Add(new Timer(waitTime, onTimerFinished, onTimerTicked, startNow)); return(timers[timers.Count - 1]); // Return a reference to the created timer. }
/// <summary> /// Creates and initializes a new instance of a Timer. /// </summary> internal Timer(float waitTime, Timer.OnTimerFinished onTimerFinished = null, Timer.OnTimerTicked onTimerTicked = null, bool startNow = true) { SetWaitTime(waitTime); this.onTimerFinished = onTimerFinished; this.onTimerTicked = onTimerTicked; if (startNow) { Start(); } else { Pause(); } }
internal Timer(float waitTime, Timer.OnTimerFinished onTimerFinished = null, Timer.OnTimerTicked onTimerTicked = null) { SetWaitTime(waitTime); this.onTimerFinished = onTimerFinished; this.onTimerTicked = onTimerTicked; }