void RecycleTimer(ActionAfterTime a, ref List <ActionAfterTime> removeFrom) { //Recycled? a.clearMe = false; ActionTimerPool.Add(a); removeFrom.Remove(a); }
//3 ActionAfterTime CreateTimer(float timer, Action action, Action updateAction, float afterTime, int id) { if (ActionTimerPool == null) { ActionTimerPool = new List <ActionAfterTime>(); } if (ActionTimerPool.Count <= 0) { ActionTimerPool.Add(new ActionAfterTime(timer, action, updateAction, afterTime, id)); ActionTimerPool.Add(new ActionAfterTime(timer, action, updateAction, afterTime, id)); } ActionAfterTime result = ActionTimerPool [0]; result.SetProperties(timer, action, updateAction, afterTime, id); ActionTimerPool.Remove(result); return(result); }