コード例 #1
0
 private void CheckFrameChange()
 {
     if (ourRenderer)
     {
         if (NewAnimTime <= Time.time)
         {
             NewAnimTime = Time.time + AnimRate;
             NextFrameDelegate?.Invoke();
         }
     }
 }
コード例 #2
0
 /// <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);
 }
コード例 #3
0
 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;
     }
 }
コード例 #4
0
 private void FramePump()
 {
     while (_continue)
     {
         if (_busy)
         {
             return;
         }
         _busy = true;
         try
         {
             NextFrame?.Invoke();
         }
         finally
         {
             _busy = false;
         }
         Thread.Sleep(_frameIntervalMs);
     }
 }
コード例 #5
0
 public void Advance()
 {
     NextFrame?.Invoke();
 }