public override void UpdateAfterSimulation100() { base.UpdateAfterSimulation100(); if (!TimerEnabled) { return; } var currentTime = MyPerGameSettings.GetElapsedMinutes(); if (m_resetOrigin) { m_originTimeMin = currentTime + m_setTimeMin - TimeToEvent; m_resetOrigin = false; } TimeToEvent = m_originTimeMin + m_setTimeMin - currentTime; if (TimeToEvent <= 0) { if (EventToTrigger != null) { EventToTrigger(Container); } if (Repeat) { m_originTimeMin = MyPerGameSettings.GetElapsedMinutes(); } else { TimerEnabled = false; } } }
private void StartTiming() { System.Diagnostics.Debug.Assert(MyPerGameSettings.GetElapsedMinutes != null, "This component must be used together with time!"); TimeToEvent = m_setTimeMin; TimerEnabled = true; m_originTimeMin = MyPerGameSettings.GetElapsedMinutes(); }