コード例 #1
0
ファイル: Simulation.cs プロジェクト: Zipcore/7dtd-WalkerSim
        private void RequestActiveZombie(ZombieAgent zombie, PlayerZone zone)
        {
            ZombieSpawnRequest spawn = new ZombieSpawnRequest();

            spawn.zombie = zombie;
            spawn.zone   = zone;
            lock (_spawnQueue)
            {
                _spawnQueue.Enqueue(spawn);
            }
        }
コード例 #2
0
        void RequestActiveZombie(ZombieAgent zombie, PlayerZone zone)
        {
            zombie.state = ZombieAgent.State.Active;

            ZombieSpawnRequest spawn = new ZombieSpawnRequest();

            spawn.zombie = zombie;
            spawn.zone   = zone;
            lock (_spawnQueue)
            {
                _spawnQueue.Enqueue(spawn);
            }
        }
コード例 #3
0
 void ProcessSpawnQueue()
 {
     for (int i = 0; i < MaxZombieSpawnsPerTick; i++)
     {
         ZombieSpawnRequest zombieSpawn = null;
         lock (_spawnQueue)
         {
             if (_spawnQueue.Count == 0)
             {
                 break;
             }
             zombieSpawn = _spawnQueue.Dequeue();
         }
         if (!CreateZombie(zombieSpawn.zombie, zombieSpawn.zone))
         {
             // Failed to spawn zombie, keep population size.
             RespawnInactiveZombie(zombieSpawn.zombie);
         }
     }
 }