예제 #1
0
        public static void Update(float totalTime)
        {
            // ensure call Create() first
            TimerMan pMan = TimerMan.GetInstance();

            Debug.Assert(pMan != null);

            pMan.mCurrTime = totalTime;

            // get the active list
            TimeEvent pEvent     = (TimeEvent)pMan.baseGetActiveList();
            TimeEvent pNextEvent = null;

            // walk the list until there is no more list or currtime is greater than timeEvent
            while (pEvent != null && (pMan.mCurrTime >= pEvent.getTriggerTime()))
            {
                // get next event
                pNextEvent = (TimeEvent)pEvent.pNext;

                if (pMan.mCurrTime > pEvent.getTriggerTime())
                {
                    // call it
                    pEvent.process();
                    // remove from active list
                    pMan.baseRemove(pEvent);
                }

                // go to next event
                pEvent = pNextEvent;
            }
        }