Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
        public static void Update(float totalTime)
        {
            // Get the instance
            TimerMan pMan = TimerMan.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
            // 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)
                {
                    // call it
                    pEvent.Process();

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

                // advance the pointer
                pEvent = pNextEvent;
            }
        }
Exemplo n.º 3
0
        public static void Remove(TimeEvent pTEnode)
        {
            TimerMan pTMan = TimerMan.PrivGetInstance();

            Debug.Assert(pTMan != null);

            Debug.Assert(pTEnode != null);
            pTMan.BaseRemove(pTEnode);
        }
Exemplo n.º 4
0
        public static void Update(float totalTime)
        {
            TimerMan pTimerMan = TimerMan.PrivGetInstance();

            Debug.Assert(pTimerMan != null);

            pTimerMan.mCurrTime = totalTime;

            TimerEvent pEvent     = (TimerEvent)pTimerMan.BaseGetActive();
            TimerEvent pNextEvent = null;

            while (pEvent != null && (pTimerMan.mCurrTime >= pEvent.GetTriggerTime()))
            {
                pNextEvent = (TimerEvent)pEvent.pNext;
                if (pTimerMan.mCurrTime >= pEvent.GetTriggerTime())
                {
                    pEvent.Process();
                    pTimerMan.BaseRemove(pEvent);
                }

                pEvent = pNextEvent;
            }
        }