Beispiel #1
0
 protected ShopSecurityState(ShopSecurityState other) : this()
 {
     for (int ii = 0; ii < other.Security.Count; ii++)
     {
         Security.Add(other.Security.GetSpawn(ii).Copy(), other.Security.GetSpawnRate(ii));
     }
 }
Beispiel #2
0
        public override IEnumerator <YieldInstruction> Apply(GameEventOwner owner, Character ownerChar, Character character, MapStatus status, bool msg)
        {
            if (status != owner || character != null)
            {
                yield break;
            }

            ////remove existing spawns
            //ZoneManager.Instance.CurrentMap.TeamSpawns.Clear();

            ShopSecurityState securityState = status.StatusStates.Get <ShopSecurityState>();

            ////add guard spawns
            //for (int ii = 0; ii < securityState.Security.Count; ii++)
            //{
            //    SpecificTeamSpawner post_team = new SpecificTeamSpawner(securityState.Security.GetSpawn(ii).Copy());
            //    ZoneManager.Instance.CurrentMap.TeamSpawns.Add(post_team, securityState.Security.GetSpawnRate(ii));
            //}

            //set spawn rate
            ZoneManager.Instance.CurrentMap.RespawnTime = 0;

            //set spawn max
            ZoneManager.Instance.CurrentMap.MaxFoes = 0;

            //spawn 10 times
            List <Loc> randLocs = ZoneManager.Instance.CurrentMap.GetFreeToSpawnTiles();

            for (int ii = 0; ii < 10; ii++)
            {
                if (randLocs.Count == 0)
                {
                    break;
                }

                int      randIndex = DataManager.Instance.Save.Rand.Next(randLocs.Count);
                Loc      dest      = randLocs[randIndex];
                MobSpawn spawn     = securityState.Security.Pick(DataManager.Instance.Save.Rand);
                yield return(CoroutineManager.Instance.StartCoroutine(PeriodicSpawnEntranceGuards.PlaceGuard(spawn, dest, GuardStatus)));

                randLocs.RemoveAt(randIndex);
            }

            List <Loc> exitLocs = WarpToEndEvent.FindExits();

            //spawn once specifically on the stairs
            foreach (Loc exitLoc in exitLocs)
            {
                Loc?dest = ZoneManager.Instance.CurrentMap.GetClosestTileForChar(null, exitLoc);
                if (!dest.HasValue)
                {
                    continue;
                }

                MobSpawn spawn = securityState.Security.Pick(DataManager.Instance.Save.Rand);
                yield return(CoroutineManager.Instance.StartCoroutine(PeriodicSpawnEntranceGuards.PlaceGuard(spawn, dest.Value, GuardStatus)));
            }
        }