internal void Update() { // we cache this so that we can use it from other threads. _frameCount = Time.frameCount; if (_firstUpdate) { _firstUpdate = false; _simulationElapsedTime = 0; _simulationElapsedTimeUnscaled = 0; _wallElapsedTime.Start(); } Action action; while (_mainThreadActionQueue.TryDequeue(out action)) { action?.Invoke(); } _simulationElapsedTime += Time.deltaTime; _simulationElapsedTimeUnscaled += Time.unscaledDeltaTime; Tick?.Invoke(Time.unscaledDeltaTime); CompleteTrackedRequests(); _forward.StartCoroutine(OnEndOfFrame()); }
public bool Tick(IDescription description) { if (time == -1) { if (trigger(description)) { onFinal?.Invoke(description); return(true); } onTick?.Invoke(description); } else if (IsStarted() || (trigger?.Invoke(description) ?? true)) { if (time == Duration) { onFirst?.Invoke(description); } if (time > 1) { onTick?.Invoke(description); } else if (time > 0) { onFinal?.Invoke(description); return(true); } if (time > 0) { time--; } } return(false); }