예제 #1
0
        public override void FinalizeInit()
        {
            base.FinalizeInit();
            Tools.UpdateStoryTellerDifficulty();

            var grid = map.GetGrid();

            grid.IterateCellsQuick(cell => cell.zombieCount = 0);

            RecalculateVisibleMap();

            var destinations  = GetterSetters.reservedDestinationsByRef(map.pawnDestinationReservationManager);
            var zombieFaction = Find.FactionManager.FirstFactionOfDef(ZombieDefOf.Zombies);

            if (!destinations.ContainsKey(zombieFaction))
            {
                map.pawnDestinationReservationManager.RegisterFaction(zombieFaction);
            }

            if (ZombieSettings.Values.betterZombieAvoidance)
            {
                var specs = AllZombies().Select(zombie => new ZombieCostSpecs()
                {
                    position = zombie.Position,
                    radius   = Tools.ZombieAvoidRadius(zombie),
                    maxCosts = ZombieMaxCosts(zombie)
                }).ToList();

                avoidGrid = Tools.avoider.UpdateZombiePositionsImmediately(map, specs);
            }
            else
            {
                avoidGrid = new AvoidGrid(map);
            }
        }
예제 #2
0
        public void UpdateZombieAvoider()
        {
            var specs = allZombiesCached.Where(zombie => zombie.Spawned && zombie.Dead == false && zombie.Downed == false)
                        .Select(zombie => new ZombieCostSpecs()
            {
                position = zombie.Position,
                radius   = Tools.ZombieAvoidRadius(zombie),
                maxCosts = ZombieMaxCosts(zombie)
            }).ToList();

            Tools.avoider.UpdateZombiePositions(map, specs);
        }