Example #1
0
        public static void Update(float totalTime)
        {
            // Get the instance
            TimerManager pInstance = TimerManager.PrivGetInstance();

            Debug.Assert(pInstance != null);

            // "Latch" the current time
            pInstance.currTime = totalTime;

            TimeEvent pEvent     = (TimeEvent)pInstance.BaseGetActive();
            TimeEvent pNextEvent = null;

            // Walk the list to end OR currTime is greater than timeEvent
            while (pEvent != null && (pInstance.currTime >= pEvent.GetTriggerTime()))
            {
                pNextEvent = (TimeEvent)pEvent.GetNext();

                if (pInstance.currTime >= pEvent.GetTriggerTime())
                {
                    // Process event
                    pEvent.Process();

                    // Remove from list
                    pInstance.BaseRemove(pEvent);
                }

                // Advance the pointer
                pEvent = pNextEvent;
            }
        }
Example #2
0
        public static void Update(float totalTime)
        {
            TimerMan pMan = TimerMan.privGetInstance();

            Debug.Assert(pMan != null);

            pMan.mCurrTime = totalTime;

            TimeEvent pEvent     = (TimeEvent)pMan.baseGetActive();
            TimeEvent pNextEvent = null;

            while (pEvent != null)// && (pMan.mCurrTime >= pEvent.triggerTime))
            {
                pNextEvent = (TimeEvent)pEvent.pNext;

                if (pMan.mCurrTime >= pEvent.triggerTime)
                {
                    pEvent.Process();

                    pMan.baseRemove(pEvent);
                }

                pEvent = pNextEvent;
            }
        }
Example #3
0
        public static void Update(float totalTime)
        {
            TimerManager pTimerMan = TimerManager.privGetInstance();

            Debug.Assert(pTimerMan != null);

            pTimerMan.mCurrentTime = totalTime;

            TimeEvent pTimeEvent = (TimeEvent)pTimerMan.baseGetActive();
            TimeEvent pNextEvent = null; // for iterating

            while (pTimeEvent != null)
            {
                //cache
                pNextEvent = (TimeEvent)pTimeEvent.pNext;

                if (pTimerMan.mCurrentTime >= pTimeEvent.GetTriggerTime())
                {
                    // do it
                    pTimeEvent.Process();

                    //remove it
                    pTimerMan.baseRemove(pTimeEvent);
                }

                // go to next
                pTimeEvent = pNextEvent;
            }
        }
Example #4
0
        public static void Update(float totalTime)
        {
            Debug.Assert(pMan != null);

            // squirrel away
            pMan.mCurTime = totalTime;

            // walk the list
            TimeEvent pEvent     = (TimeEvent)pMan.poActive;
            TimeEvent pNextEvent = null;

            // Walk the list until there is no more list OR currTime is greater than timeEvent
            // ToDo Fix: List needs to be sorted
            while (pEvent != null /*&& (pMan.mCurTime >= pEvent.triggerTime)*/)
            {
                pNextEvent = (TimeEvent)pEvent.pNext;

                if (pMan.mCurTime >= pEvent.triggerTime)
                {
                    pEvent.Process();

                    pMan.baseRemove(pEvent);
                }

                // advance the pointer
                pEvent = pNextEvent;
            }
        }
Example #5
0
        public static void Update(float TotalTime)
        {
            TimerMan pTMan = TimerMan.PrivGetInstance();

            Debug.Assert(pTMan != null);

            //wasn't sure how we started the timer until i saw its use in the game.cs
            pTMan.mCurrentTime = TotalTime;

            TimeEvent pEvent = (TimeEvent)pTMan.BaseGetActive();

            //set the next to walk the list
            TimeEvent pNextEvent = null;

            while (pTMan.mCurrentTime >= pEvent.trigger)
            {
                //trigger event
                if (pTMan.mCurrentTime >= pEvent.trigger)
                {
                    pEvent.Process();

                    //intially i instantiated this outside of the loop "as-is" and it caused issues
                    pNextEvent = (TimeEvent)pEvent.pNext;

                    pTMan.BaseRemove(pEvent);
                }



                pEvent = pNextEvent;
            }
        }
Example #6
0
        public static void Update(float totalTime)
        {
            // Get the instance
            TimerManager pMan = TimerManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            // squirrel away
            pMan.mCurrTime = totalTime;

            // walk the list
            TimeEvent pEvent     = (TimeEvent)pMan.BaseGetActive();
            TimeEvent pNextEvent = null;

            // Walk the list until there is no more list OR currTime is greater than timeEvent
            // List needs to be sorted by trigger time
            while (pEvent != null && (pMan.mCurrTime >= pEvent.triggerTime))
            {
                // Difficult to walk a list and remove itself from the list
                // so squirrel away the next event now, use it at bottom of while
                pNextEvent = (TimeEvent)pEvent.GetNext();

                if (pMan.mCurrTime >= pEvent.triggerTime)
                {
                    // call it
                    pEvent.Process();

                    // remove from list
                    pMan.BaseRemove(pEvent);
                }

                // advance the pointer
                pEvent = pNextEvent;
            }
        }
        public static void Update(float totalTime)
        {
            // Get the instance
            TimerManager pMan = TimerManager.pActiveMan;

            Debug.Assert(pMan != null);

            // squirrel away
            pMan.mCurrTime = totalTime;

            // walk the list
            TimeEvent pEvent     = (TimeEvent)pMan.BaseGetActive();
            TimeEvent pNextEvent = null;

            // Walk the list until there is no more list OR currTime is greater than timeEvent
            // ToDo Fix: List needs to be sorted
            while (pEvent != null)// && (pMan.mCurrTime >= pEvent.triggerTime))
            {
                // Difficult to walk a list and remove itself from the list
                // so squirrel away the next event now, use it at bottom of while
                pNextEvent = (TimeEvent)pEvent.pNext;

                if (pMan.mCurrTime >= pEvent.triggerTime)
                {
                    pEvent.Process();
                    pMan.BaseRemove(pEvent);
                }
                pEvent = pNextEvent;
            }
        }
Example #8
0
        public static void Update(float totalTime)
        {
            TimerManager pMan = TimerManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            // squirrel away
            pMan.currentTime = totalTime;

            // walk the list
            TimeEvent pEvent     = (TimeEvent)pMan.BaseGetActive();
            TimeEvent pNextEvent = null;

            // Walk the list until there is no more list OR currTime is greater than timeEvent
            while (pEvent != null && pMan.currentTime >= pEvent.triggerTime)
            {
                pNextEvent = (TimeEvent)pEvent.pNext;
                pEvent.Process();
                pMan.BaseRemove(pEvent);

                // advance the pointer
                pEvent = pNextEvent;
            }
        }