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; } }
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; } }
public static void Remove(TimeEvent pNode) { TimerMan pMan = TimerMan.privGetInstance(); Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.baseRemove(pNode); }
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); }
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; } }