/******************************************************************** * 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()); }
static EnemyManager enemyManager; // Manager that will handle enemy after spawning /******************************************************************** * Initialization and creation of spawn pool ********************************************************************/ void Start() { spawnQueue = new EnemyList(); if (enemyManager == null) { enemyManager = SmGameManager.GetEnemyManager; } timeSinceSpawning = 0f; timeSinceNewEnemy = 0f; hasSpawnedFirstEnemy = false; if (spawnPoolCreator.Count.Equals(0)) { Debug.Log("Spawner has empty spawn list", this); spawnPool = new List <Enemy>(); } else { BuildSpawnPool(); } }