private void CheckFrameChange() { if (ourRenderer) { if (NewAnimTime <= Time.time) { NewAnimTime = Time.time + AnimRate; NextFrameDelegate?.Invoke(); } } }
/// <summary> /// Must be called each frame /// </summary> public void Frame() { _frames++; if (Math.Abs(Environment.TickCount - _lastTickCount) > 1000) { _lastFrameRate = (float)_frames * 1000 / Math.Abs(Environment.TickCount - _lastTickCount); _lastTickCount = Environment.TickCount; _frames = 0; } NextFrame?.Invoke(this, null); }
private void DispatchNextFrame(object sender, EventArgs args) { // naive solution for skipping frames if previous execution takes to long // TODO: what happens if there are more than one coroutine running... maybe there should be a busy flag for each item in invocation list if (_busy) { return; } _busy = true; try { NextFrame?.Invoke(); } finally { _busy = false; } }
private void FramePump() { while (_continue) { if (_busy) { return; } _busy = true; try { NextFrame?.Invoke(); } finally { _busy = false; } Thread.Sleep(_frameIntervalMs); } }
public void Advance() { NextFrame?.Invoke(); }