/** * Invoke callback once and destroy timer */ public static TimerControl CreateTimer(GameObject gameObj, Action callback, float duration, bool repeat) { TimerControl timer = gameObj.AddComponent <TimerControl>(); TimerData data = new TimerData(); data.duration = duration; data.repeat = repeat; timer.Add(data); timer[0].AddCallback(callback); return(timer); }
public void Add(TimerData data) { Array.Resize <TimerData>(ref timers, timers.Length + 1); timers[timers.Length - 1] = data; ResizeTimer(); }
public Timer(TimerData data) { this.data = data; }
public Timer() { this.data = new TimerData(); }
public void SetTimerData(float dur, Action callback, bool loop = false) { this.data = new TimerData(dur, callback); this.data.repeat = loop; }
public void SetTimerData(TimerData data) { this.data = data; }