Ejemplo n.º 1
0
        private void RequestActiveZombie(ZombieAgent zombie, PlayerZone zone)
        {
            ZombieSpawnRequest spawn = new ZombieSpawnRequest();

            spawn.zombie = zombie;
            spawn.zone   = zone;
            lock (_spawnQueue)
            {
                _spawnQueue.Enqueue(spawn);
            }
        }
Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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);
         }
     }
 }