Пример #1
0
        ///////////////////////////////////////////////////////
        //
        // Private Methods
        //
        ///////////////////////////////////////////////////////


        // Bypass to AbstractManager's BaseCreate()
        // So that the new node is sorted in the active list
        private TimedEvent NewBaseCreate(float seconds)
        {
            // Refill reserves if it ran out
            if (this.ReservedSize <= 0)
            {
                this.FillReserve(this.AdditionalReserveSize);
                Debug.Assert(this.ReservedSize > 0);
            }

            // Move a node from the reserves to the active list
            TimedEvent newNode = this.reservedList.PopFront() as TimedEvent;

            newNode.SetId(this.currentId++);
            newNode.AddTime(seconds, this.currentUpdateTime);
            this.activeList.PushSorted(newNode);
            return(newNode as TimedEvent);
        }
Пример #2
0
        /// <summary>
        ///		Unpaused this timer by updating all internal events
        ///		given the correct current Azul time
        /// </summary>
        /// <param name="correctAzulTime"></param>
        public void Unpause(float correctAzulTime)
        {
            this.isPaused = false;

            // Calculate how much time elapsed since pausing
            float timeElapsed = correctAzulTime - this.currentUpdateTime;

            // Go through every TimedEvent and add this elapsed time
            TimedEvent itr = this.activeList.Head as TimedEvent;

            while (itr != null)
            {
                // Update the event
                itr.AddTime(timeElapsed);

                // Next event
                itr = itr.next as TimedEvent;
            }
        }