/////////////////////////////////////////////////////// // // Methods // /////////////////////////////////////////////////////// /// <summary> /// Updates the timed events to see if any need to be executed /// </summary> /// <param name="currentTime"> /// Current Azul time of the game /// </param> public void Update(float currentTime) { // Only update if not paused if (this.isPaused == false) { // Store current Azul game time this.currentUpdateTime = currentTime; // Go though every node less than current time TimedEvent itr = this.activeList.Head as TimedEvent; while (itr != null) { // If the current event's stamp is less than the currTime if (itr.TimeStamp < currentTime) { // Execute the event's command itr.OnTimeIsUp(); // Next node TimedEvent popped = this.activeList.PopFront() as TimedEvent; popped.Reset(); this.reservedList.PushFront(popped); itr = this.activeList.Head as TimedEvent; } // Else if the event stamp is bigger than currTime else { // No need to check anymore break; } } } }
/// <summary> /// Recycles the given TimedEvent reference for object pooling /// </summary> /// <param name="oldTimedEvent"></param> /// <returns></returns> public bool Recycle(TimedEvent oldTimedEvent) { TimedEvent oldNode = this.NewBaseRecycle(oldTimedEvent); if (oldNode == null) { return(false); } oldNode.Reset(); return(true); }