Example #1
0
 public void Update()
 {
     if (Started)
     {
         m_elapsedTime += MyConstants.PHYSICS_STEP_SIZE_IN_MILLISECONDS;
         int index = 0;
         while (index < m_registeredActions.Count)
         {
             MyTimerAction timerAction = m_registeredActions[index];
             if (ElapsedTime >= timerAction.StartTime)
             {
                 Debug.Assert(!timerAction.Launched);
                 timerAction.Launch();
                 if (m_registeredActions.Count > 0)
                 {
                     m_registeredActions.RemoveAt(index);
                 }
             }
             else
             {
                 timerAction.Update(ElapsedTime);
                 index++;
             }
         }
     }
 }
Example #2
0
        public void RegisterTimerAction(int startTime, MyTimerActionDelegate timerActionDelegate, bool fromMissionStart = true, string displayNotification = null, bool showTimeFromStart = false)
        {
            int           timerActionStartTime = startTime + (fromMissionStart ? 0 : ElapsedTime);
            MyTimerAction timerAction          = new MyTimerAction(timerActionStartTime, timerActionDelegate, displayNotification, showTimeFromStart);

            if (Started)
            {
                timerAction.Start();
            }
            m_registeredActions.Add(timerAction);
        }
Example #3
0
 public void RegisterTimerAction(int startTime, MyTimerActionDelegate timerActionDelegate, bool fromMissionStart = true, string displayNotification = null, bool showTimeFromStart = false)
 {
     int timerActionStartTime = startTime + (fromMissionStart ? 0 : ElapsedTime);
     MyTimerAction timerAction = new MyTimerAction(timerActionStartTime, timerActionDelegate, displayNotification, showTimeFromStart);
     if (Started)
     {
         timerAction.Start();
     }
     m_registeredActions.Add(timerAction);
 }