public void RemoveProgressable(IProgressable progressable) { int timeRequired = progressable.Setup(); foreach (TickTimer timer in timers) { if (timer.TotalTicksToCall == timeRequired) { timer.Remove(ref progressable); break; } } }
public void AddProgressable(IProgressable progressable) { TickTimer timer = null; int timeRequired = progressable.Setup(); // Looks for an existing timer foreach (TickTimer t in timers) { if (t.TotalTicksToCall == timeRequired) { timer = t; timer.Add(ref progressable); break; } } // Makes a new timer if (timer == null) { timer = new TickTimer(timeRequired); timer.Add(ref progressable); timers.Add(timer); } }