public void RegisterClockTimeObserver(IViewClockTimeObserver observer, float tickSize) { if (observer == null) { return; } float accumulator = 0f; bool flag = false; int i = 0; int length = this.clockTimeObservers.Length; while (i < length) { ViewClockTimeObserver viewClockTimeObserver = this.clockTimeObservers.Array[i]; if (viewClockTimeObserver.Observer == observer) { return; } if (!flag && viewClockTimeObserver.TickSize == tickSize) { accumulator = viewClockTimeObserver.Accumulator; flag = true; } i++; } if (!flag) { accumulator = MathUtils.FloatMod(this.timeLast, tickSize); } this.clockTimeObservers.Add(new ViewClockTimeObserver(observer, tickSize, accumulator)); }
public void UnregisterClockTimeObserver(IViewClockTimeObserver observer) { int i = 0; int length = this.clockTimeObservers.Length; while (i < length) { if (this.clockTimeObservers.Array[i].Observer == observer) { this.clockTimeObservers.RemoveAt(i); this.clockMiter.OnRemove(i); break; } i++; } }
public void UnregisterClockTimeObserver(IViewClockTimeObserver observer) { int i = 0; int count = this.clockTimeObservers.Count; while (i < count) { if (this.clockTimeObservers[i].Observer == observer) { this.clockTimeObservers.RemoveAt(i); this.clockMiter.OnRemove(i); return; } i++; } }
public ViewClockTimeObserver(IViewClockTimeObserver observer, float tickSize, float accumulator) { this.Observer = observer; this.TickSize = tickSize; this.Accumulator = accumulator; }