public void Init(float time, OnTimerCompleteDelegate onComplete, OnTimerUpdateDelegate onUpdate) { m_time = time; m_completeHandler = onComplete; m_onUpdate = onUpdate; IsRunning = false; }
public static SimpleTimer StartTimer(float time, OnTimerCompleteDelegate onComplete, OnTimerUpdateDelegate onUpdate = null, bool autoStart = true) { timerId++; SimpleTimer timer = new GameObject().AddComponent <SimpleTimer>(); timer.name = "SimpleTimer_" + timerId; timer.Init(time, onComplete, onUpdate); timer.DestroyOnComplete = true; if (autoStart) { timer.StartTimer(); } return(timer); }