Ejemplo n.º 1
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;
            }
        }
Ejemplo n.º 2
0
        //----------------------------------------------------------------------------------
        // Static Methods
        //----------------------------------------------------------------------------------
        public static float GetCurrentTime()
        {
            TimerManager pTimerMan = TimerManager.privGetInstance();

            Debug.Assert(pTimerMan != null);

            return(pTimerMan.mCurrentTime);
        }
Ejemplo n.º 3
0
        public static void Print()
        {
            TimerManager pTimerMan = TimerManager.privGetInstance();

            Debug.Assert(pTimerMan != null);

            pTimerMan.basePrint();
        }
Ejemplo n.º 4
0
        public static void Remove(TimeEvent pLink)
        {
            TimerManager pTimerMan = TimerManager.privGetInstance();

            Debug.Assert(pTimerMan != null);

            Debug.Assert(pLink != null);
            pTimerMan.baseRemove(pLink);
        }
Ejemplo n.º 5
0
        public static TimeEvent Find(TimeEvent.Name theName)
        {
            TimerManager pTimerMan = TimerManager.privGetInstance();

            Debug.Assert(pTimerMan != null);

            Debug.Assert(pTimerMan.poNodeCompare != null);
            pTimerMan.poNodeCompare.Wash();
            pTimerMan.poNodeCompare.SetName(theName);

            TimeEvent pTimeEvent = (TimeEvent)pTimerMan.baseFind(pTimerMan.poNodeCompare);

            return(pTimeEvent);
        }
Ejemplo n.º 6
0
        public static TimeEvent Add(TimeEvent.Name timeName, Command pCmd, float timeToTrigger)
        {
            TimerManager pMan = TimerManager.privGetInstance();

            Debug.Assert(pMan != null);

            TimeEvent pNode = (TimeEvent)pMan.baseAdd();

            Debug.Assert(pNode != null);
            Debug.Assert(pCmd != null);
            Debug.Assert(timeToTrigger >= 0.0f);

            pNode.Set(timeName, pCmd, timeToTrigger);
            return(pNode);
        }
Ejemplo n.º 7
0
        public static void PauseUpdate(float delta)
        {
            // Get the instance
            TimerManager pMan = TimerManager.privGetInstance();

            Debug.Assert(pMan != null);

            // walk the list
            TimeEvent pEvent = (TimeEvent)pMan.baseGetActive();

            while (pEvent != null)
            {
                pEvent.triggerTime += delta;
                // advance the pointer
                pEvent = (TimeEvent)pEvent.pNext;
            }
        }