/// <summary> /// Called before each game simulation tick. A tick contains multiple frames. /// Performs the dispatching for this simulation phase. /// </summary> public override void OnBeforeSimulationTick() { if (SimulationManager.instance.SimulationPaused || SimulationManager.instance.ForcedSimulationPaused) { wasPaused = true; return; } WeatherInfo?.Update(); bool updateFrameLength = TimeAdjustment?.Update(wasPaused) ?? false; wasPaused = false; if (CitizenProcessor != null) { if (updateFrameLength) { CitizenProcessor.UpdateFrameDuration(); } CitizenProcessor.ProcessTick(); } if (updateFrameLength) { Buildings?.UpdateFrameDuration(); Statistics?.RefreshUnits(); VanillaEvents.ProcessUpdatedTimeSpeed(TimeAdjustment.GetOriginalTime); } EventManager?.ProcessEvents(); if (DayTimeSimulation == null || CitizenProcessor == null) { return; } DateTime currentDateTime = SimulationManager.instance.m_currentGameTime; if (currentDateTime.Hour != lastHandledDate.Hour || lastHandledDate == default) { int triggerHour = lastHandledDate == default ? 0 : currentDateTime.Hour; lastHandledDate = currentDateTime; CitizenProcessor.TriggerHour(triggerHour); if (triggerHour == 0) { DayTimeSimulation.Process(currentDateTime); OnNewDay(this); } } }
/// <summary> /// Called before each game simulation tick. A tick contains multiple frames. /// Performs the dispatching for this simulation phase. /// </summary> public override void OnBeforeSimulationTick() { WeatherInfo?.Update(); EventManager?.ProcessEvents(); bool updateFrameLength = TimeAdjustment?.Update() ?? false; if (CitizenProcessor != null) { if (updateFrameLength) { CitizenProcessor.UpdateFrameDuration(); } CitizenProcessor.ProcessTick(); } if (updateFrameLength) { Buildings?.UpdateFrameDuration(); } if (DayTimeSimulation == null || CitizenProcessor == null) { return; } DateTime currentDate = SimulationManager.instance.m_currentGameTime.Date; if (currentDate != lastHandledDate) { lastHandledDate = currentDate; DayTimeSimulation.Process(currentDate); CitizenProcessor.StartNewDay(); OnNewDay(this); } }
/// <summary> /// Called before each game simulation tick. A tick contains multiple frames. /// Performs the dispatching for this simulation phase. /// </summary> public override void OnBeforeSimulationTick() { WeatherInfo?.Update(); EventManager?.ProcessEvents(); if (CitizenProcessor != null) { CitizenProcessor.ProcessTick(); if (TimeAdjustment != null && TimeAdjustment.Update()) { CitizenProcessor.SetFrameDuration(TimeAdjustment.HoursPerFrame); } } DateTime currentDate = SimulationManager.instance.m_currentGameTime.Date; if (currentDate != lastHandledDate) { lastHandledDate = currentDate; DayTimeSimulation?.Process(currentDate); CitizenProcessor?.StartNewDay(); OnNewDay(this); } }