Ejemplo n.º 1
0
        /// <summary>
        /// Updates the current set of Battle Events.
        /// </summary>
        public void UpdateBattleEvents()
        {
            //There are no more BattleEvents to update
            if (HasBattleEvents == false)
            {
                return;
            }

            //Update all Battle Events
            for (int i = 0; i < BattleEvents[CurHighestPriority].Count; i++)
            {
                BattleEvent battleEvent = BattleEvents[CurHighestPriority][i];

                //Start the Battle Event if it hasn't started already
                if (battleEvent.HasStarted == false)
                {
                    battleEvent.Start();
                }

                battleEvent.Update();
                if (battleEvent.IsDone == true)
                {
                    //Remove the BattleEvent if it's finished
                    BattleEvents[CurHighestPriority].RemoveAt(i);
                    i--;
                }
            }

            //If we're done with all Battle Events with this priority, remove the priority and find the next highest priority to update
            if (BattleEvents[CurHighestPriority].Count == 0)
            {
                BattleEvents.Remove(CurHighestPriority);
                CurHighestPriority = FindNextHighestBattleEventPriority();
            }
        }