//Function called externally to start a timer with a designated action public static JUCLTimer Create(Action action, float timer, string timerName = null) { InitIfNeeded(); GameObject gameObject = new GameObject("JUCL timer", typeof(MonoBehaviourHook)); JUCLTimer juclTimer = new JUCLTimer(action, timer, timerName, gameObject); gameObject.GetComponent <MonoBehaviourHook>().onUpdate = juclTimer.Update; activeTimerList.Add(juclTimer); return(juclTimer); }
//Removes the timer private static void RemoveTimer(JUCLTimer timer) { InitIfNeeded(); activeTimerList.Remove(timer); }