示例#1
0
        public IEnumerator <YieldInstruction> BeginFloor()
        {
            DataManager.Instance.Save.Trail.Add(ZoneManager.Instance.CurrentMap.GetColoredName());
            LogMsg(Text.FormatKey("MSG_ENTER_MAP", ActiveTeam.GetDisplayName(), ZoneManager.Instance.CurrentMap.GetColoredName()), true, false);

            ZoneManager.Instance.CurrentMap.Begun = true;

            //process player happenings
            foreach (Character character in ZoneManager.Instance.CurrentMap.IterateCharacters())
            {
                character.Tactic.Initialize(character);
            }

            //map starts for map statuses
            EventEnqueueFunction <SingleCharEvent> function = (StablePriorityQueue <GameEventPriority, EventQueueElement <SingleCharEvent> > queue, Priority maxPriority, ref Priority nextPriority) =>
            {
                //start with universal
                DataManager.Instance.UniversalEvent.AddEventsToQueue(queue, maxPriority, ref nextPriority, DataManager.Instance.UniversalEvent.OnMapStarts, null);
                ZoneManager.Instance.CurrentMap.MapEffect.AddEventsToQueue(queue, maxPriority, ref nextPriority, ZoneManager.Instance.CurrentMap.MapEffect.OnMapStarts, null);

                foreach (MapStatus mapStatus in ZoneManager.Instance.CurrentMap.Status.Values)
                {
                    MapStatusData entry = DataManager.Instance.GetMapStatus(mapStatus.ID);
                    mapStatus.AddEventsToQueue <SingleCharEvent>(queue, maxPriority, ref nextPriority, entry.OnMapStarts, null);
                }

                int portPriority = 0;
                foreach (Character character in ZoneManager.Instance.CurrentMap.IterateCharacters())
                {
                    if (!character.Dead)
                    {
                        foreach (PassiveContext effectContext in character.IteratePassives(new Priority(portPriority)))
                        {
                            effectContext.AddEventsToQueue(queue, maxPriority, ref nextPriority, effectContext.EventData.OnMapStarts, character);
                        }
                    }
                    portPriority++;
                }
            };

            foreach (EventQueueElement <SingleCharEvent> effect in IterateEvents <SingleCharEvent>(function))
            {
                yield return(CoroutineManager.Instance.StartCoroutine(effect.Event.Apply(effect.Owner, effect.OwnerChar, effect.TargetChar)));
            }

            yield return(CoroutineManager.Instance.StartCoroutine(ZoneManager.Instance.CurrentMap.OnEnter()));

            LogMsg(Text.DIVIDER_STR);
        }