public void RegisterClockTimeObserver(ClockTimeObserver observer, float tickSize) { if (observer == null) { return; } float accumulator = 0.0f; bool flag = false; int index = 0; for (int count = this.clockTimeObservers.Count; index < count; ++index) { ViewClockTimeObserver clockTimeObserver = this.clockTimeObservers[index]; if (clockTimeObserver.Observer == observer) { return; } if (!flag && (double)clockTimeObserver.TickSize == (double)tickSize) { accumulator = clockTimeObserver.Accumulator; flag = true; } } if (!flag) { accumulator = MathUtils.FloatMod(this.timeLast, tickSize); } this.clockTimeObservers.Add(new ViewClockTimeObserver(observer, tickSize, accumulator)); }
public void UnregisterClockTimeObserver(ClockTimeObserver observer) { int index = 0; for (int count = this.clockTimeObservers.Count; index < count; ++index) { if (this.clockTimeObservers[index].Observer == observer) { this.clockTimeObservers.RemoveAt(index); this.clockMiter.OnRemove(index); break; } } }
public ViewClockTimeObserver(ClockTimeObserver observer, float tickSize, float accumulator) { this.Observer = observer; this.TickSize = tickSize; this.Accumulator = accumulator; }