public ACTimer CreateTimer(float waitTime, float timeInterval) { ACTimer timer = _GetUnusedTimer(); timer.timeId = _timerIndex; timer.runTimes = 0; timer.startTime = 0; timer.waitTime = waitTime; timer.timeInterval = timeInterval; _timerIndex++; return(timer); }
private ACTimer _GetUnusedTimer() { ACTimer timer; if (_unusedTimers.Count > 0) { timer = _unusedTimers.Dequeue(); } else { timer = new ACTimer(); } return(timer); }
public void StopTimer(ACTimer timer) { _timer.Remove(timer); _unusedTimers.Enqueue(timer); }
public void StartTimer(ACTimer timer, System.Action onTimeup) { timer.startTime = Time.time; timer.onTimeup = onTimeup; _timer.Add(timer); }