Пример #1
0
 /********************************************************************
 * Add a new enemy to the list of active enemies.
 *
 * @param   enemy       Enemy that was spawned
 * @return              If the enemy was placed in the enemies list
 ********************************************************************/
 public bool TrackEnemy(Enemy enemy)
 {
     if (canSpawnEnemies)
     {
         enemies.AddLast(enemy);
         CheckCanSpawnEnemies();
         return(true);
     }
     return(false);
 }
Пример #2
0
        /********************************************************************
        * Look for any enemies already in the game and enemy spawners.
        * Also flag canSpawnEnemies to let EnemySpawners know if they can spawn.
        ********************************************************************/
        void Awake()
        {
            enemies = new EnemyList();
            EnemyList.AddNewFreeListNodes(freeListSize);

            Enemy[] foundEnemies = FindObjectsOfType <Enemy>();
            foreach (Enemy enemy in foundEnemies)
            {
                enemies.AddLast(enemy);
            }

            CheckCanSpawnEnemies();
            spawners        = FindObjectsOfType <EnemySpawner>();
            deadRespawnList = new SortedEnemyList(new EnemyComparerRespawnTime());
        }
Пример #3
0
 /********************************************************************
 * Add an already existing enemy to be spawned.  Generally this is one
 * that reached an exit and was flagged to be respawned.
 *
 * @param   enemy           The enemy to add
 ********************************************************************/
 public void AddEnemyToRespawn(Enemy enemy)
 {
     spawnQueue.AddLast(enemy);
 }