예제 #1
0
        /**
         * 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);
        }
예제 #2
0
 public void Add(TimerData data)
 {
     Array.Resize <TimerData>(ref timers, timers.Length + 1);
     timers[timers.Length - 1] = data;
     ResizeTimer();
 }
예제 #3
0
 public Timer(TimerData data)
 {
     this.data = data;
 }
예제 #4
0
 public Timer()
 {
     this.data = new TimerData();
 }
예제 #5
0
 public void SetTimerData(float dur, Action callback, bool loop = false)
 {
     this.data        = new TimerData(dur, callback);
     this.data.repeat = loop;
 }
예제 #6
0
 public void SetTimerData(TimerData data)
 {
     this.data = data;
 }