Exemplo n.º 1
0
 public void UnregisterSchedule(ScheduleEntry scheduleEntry)
 {
     this._schedulesToRemove.Add(scheduleEntry);
 }
Exemplo n.º 2
0
        void Update()
        {
            int count = this._updatesToRemove.Count;

            for (int i = 0; i < count; i++)
            {
                this._updates.Remove(this._updatesToRemove[i]);
            }
            this._updatesToRemove.Clear();

            count = this._updates.Count;
            for (int i = 0; i < count; i++)
            {
                this._updates[i].Invoke(Time.deltaTime);
            }

            ////////////////schedule

            count = this._schedulesToRemove.Count;
            for (int i = 0; i < count; i++)
            {
                this._schedules.Remove(this._schedulesToRemove[i]);
            }
            this._schedulesToRemove.Clear();

            count = this._schedules.Count;
            for (int i = 0; i < count; i++)
            {
                ScheduleEntry scheduleEntry = this._schedules[i];
                scheduleEntry.OnUpdate(Time.deltaTime);
                if (scheduleEntry.finished)
                {
                    this.UnregisterSchedule(scheduleEntry);
                }
            }

            count = this._schedulesToRemove.Count;
            for (int i = 0; i < count; i++)
            {
                this._schedules.Remove(this._schedulesToRemove[i]);
            }
            this._schedulesToRemove.Clear();

            /////////////////// timer

            count = this._timersToRemove.Count;
            for (int i = 0; i < count; i++)
            {
                this._timers.Remove(this._timersToRemove[i]);
            }
            this._timersToRemove.Clear();

            count = this._timers.Count;
            for (int i = 0; i < count; i++)
            {
                TimerEntry timerEntry = this._timers[i];
                timerEntry.OnUpdate(Time.deltaTime);
                if (timerEntry.finished)
                {
                    this.UnregisterTimer(timerEntry);
                }
            }

            count = this._timersToRemove.Count;
            for (int i = 0; i < count; i++)
            {
                this._timers.Remove(this._timersToRemove[i]);
            }
            this._timersToRemove.Clear();
        }