Currently attempting to make zombies spawn in waves.
I am using script found at http://wiki.unity3d.com/index.php?title=Enemy_Spawner
I understand how the spawning of a wave works however when implemented to multiple spawn locations the script becomes useless because the zombies will keep spawning at the same location because it only applies to a single spawner and not the entire game.
Is there a way to reference each spawner and make zombies spawn at those locations?
Also, is there a way to implement a wave counting system, one which can track all zombies killed rather than those relating to that specific spawner?
You can use only one instance of the spawner and create a list of spawning position that are stored in an array (or a List)
You can modify spawnEnemy method so that it uses a random spawn position.
private void spawnEnemy()
{
GameObject Enemy = (GameObject)Instantiate(Enemies[enemyLevel], GetRandomSpawnPoint(), Quaternion.identity);
Enemy.SendMessage("setName", SpawnID);
// Increase the total number of enemies spawned and the number of spawned enemies
numEnemy++;
spawnedEnemy++;
}
private Vector3 GetRandomSpawnPoint(){
// here you would choose a position of a random (or not) Spawn Point and return it;
//select a random SpawnPoint from a list and return it's position
//you can fiddle with this so that maybe you could sequentially traverse all spawn points rather than choosing a random one each time.
}
For tracking all the zombies that were killed I suggest you let this video inspire you.