コード例 #1
0
ファイル: TimerMan.cs プロジェクト: abergie5b/SpaceInvaders
        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;
            }
        }
コード例 #2
0
ファイル: TimerMan.cs プロジェクト: AlfredYan/Space_Invaders
        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;
            }
        }
コード例 #3
0
ファイル: TimerMan.cs プロジェクト: abergie5b/SpaceInvaders
        public static void Remove(TimeEvent pNode)
        {
            TimerMan pMan = TimerMan.privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemove(pNode);
        }
コード例 #4
0
ファイル: TimerMan.cs プロジェクト: AlfredYan/Space_Invaders
        public static void Remove(TimeEvent pNode)
        {
            // ensure call Create() first
            TimerMan pMan = TimerMan.GetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemove(pNode);
        }
コード例 #5
0
        public static void Update(float totalTime)
        {
            // Get the instance
            //TimerMan pMan = TimerMan.privGetInstance();
            TimerMan pMan = TimerMan.pActiveTmMan;

            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)
            {
                // 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;
            }
        }