public void OnUpdate() { float num = this.Now(); float num2 = num - this.timeLast; this.timeLast = num; float num3 = num2; int num4 = 0; while (num3 > 0f) { float num5 = (num3 <= this.timePerFrame) ? num3 : this.timePerFrame; this.physMiter.Init(this.physTimeObservers.Length); while (this.physMiter.Active()) { IViewPhysicsTimeObserver viewPhysicsTimeObserver = this.physTimeObservers.Array[this.physMiter.Index]; viewPhysicsTimeObserver.OnViewPhysicsTime(num5); this.physMiter.Next(); } this.physMiter.Reset(); if (++num4 == 5) { break; } num3 -= num5; } this.frameMiter.Init(this.frameTimeObservers.Length); while (this.frameMiter.Active()) { IViewFrameTimeObserver viewFrameTimeObserver = this.frameTimeObservers.Array[this.frameMiter.Index]; viewFrameTimeObserver.OnViewFrameTime(num2); this.frameMiter.Next(); } this.frameMiter.Reset(); this.clockMiter.Init(this.clockTimeObservers.Length); while (this.clockMiter.Active()) { ViewClockTimeObserver viewClockTimeObserver = this.clockTimeObservers.Array[this.clockMiter.Index]; float num6 = viewClockTimeObserver.Accumulator + num2; float tickSize = viewClockTimeObserver.TickSize; while (num6 >= tickSize) { viewClockTimeObserver.Observer.OnViewClockTime(tickSize); num6 -= tickSize; } viewClockTimeObserver.Accumulator = num6; this.clockMiter.Next(); } this.clockMiter.Reset(); }
public int IndexOf(IViewPhysicsTimeObserver element) { IViewPhysicsTimeObserver[] array = this.Array; int length = this.Length; for (int i = 0; i < length; i++) { if (array[i].Equals(element)) { return(i); } } return(-1); }
public void Add(IViewPhysicsTimeObserver element) { IViewPhysicsTimeObserver[] array = this.Array; int length = this.Length; int capacity = this.Capacity; if (length == capacity) { int num = capacity * 2; IViewPhysicsTimeObserver[] array2 = new IViewPhysicsTimeObserver[num]; for (int i = 0; i < length; i++) { array2[i] = array[i]; } this.Array = array2; this.Capacity = num; array = array2; } array[length] = element; this.Length++; }
public void Insert(int index, IViewPhysicsTimeObserver element) { IViewPhysicsTimeObserver[] array = this.Array; int length = this.Length; int capacity = this.Capacity; if (length == capacity) { int num = capacity * 2; IViewPhysicsTimeObserver[] array2 = new IViewPhysicsTimeObserver[num]; for (int i = 0; i < length; i++) { array2[i] = array[i]; } this.Array = array2; this.Capacity = num; array = array2; } if (index == length) { array[length] = element; this.Length++; } else { IViewPhysicsTimeObserver viewPhysicsTimeObserver = array[index]; array[index] = element; for (int j = index + 1; j < length; j++) { IViewPhysicsTimeObserver viewPhysicsTimeObserver2 = array[j]; array[j] = viewPhysicsTimeObserver; viewPhysicsTimeObserver = viewPhysicsTimeObserver2; } array[length] = viewPhysicsTimeObserver; this.Length++; } }