public static void Remove(TimerEvent pNode) { TimerEventManager pMan = TimerEventManager.privGetInstance(); Debug.Assert(pMan != null); Debug.Assert(pNode != null); pMan.baseRemoveNode(pNode); }
public static void Update(float totalTime) { // Get the instance TimerEventManager pTimerEventManager = TimerEventManager.privGetInstance(); // store the current time pTimerEventManager.currTime = totalTime; // walk the event list TimerEvent pEvent = (TimerEvent)pTimerEventManager.baseGetActive(); TimerEvent nextEvent = null; // Walk the list until currTime is greater than timeEvent triggerTime while (pEvent != null) { // get the next event early in case this event executes and is removed nextEvent = (TimerEvent)pEvent.pMNext; if (pTimerEventManager.currTime >= pEvent.triggerTime) { //Debug.WriteLine("{0} Event Triggered!", pEvent.GetName()); //Debug.WriteLine("Trigger Time:{0}", pTimerEventManager.currTime); // execute the event pEvent.Process(); // remove event from list after execution pTimerEventManager.baseRemoveNode(pEvent); } else { // early out, since the list is sorted break; } // advance the pointer pEvent = nextEvent; } }