Help creating a Wavesystem

Hi I am trying to create a zombie type of wave spawner that initiates the zombies and then gives them more health every wave. This is my code when a new wave begins. Can anyone help me make this work.

// Spawn zombies Then:
 var Zombies = GameObject.FindGameObjectsWithTag("Zombie");
 for each(var health : int in Zombies) {
 health = health + HpExtra;

The whole system depends a lot of your idea about how the game works. But the concrete case of the health, I’m assuming you have a kind of “wave index”. So you may do an incrementating hp multiplying an “offsetHP” float var with the wave index. The same applicable for the zombies nuber, or their speed, for example. Ex ( in c#, I don’t know the js grammar :P):

int waveIndex = 0;

int zombiesAmount = 3;
int zombiesIncrement = 2;

float slowZombiesSpeed = 5f;
float hardZombiesSpeed = 8f;

float speedIncrement = 0.2f;
float healthIncrement = 0.25f;


private void NewWave()
   waveIndex ++;
   zombiesAmount = zombiesIncrement  * waveIndex;
   slowZombiesSpeed = speedIncrement * waveIndex;
   hardZombiesSpeed = speedIncrement * waveIndex;
   health = healthIncrement * waveIndex;

   //In this method you instantiate the zombies with the new property values 

Also you may have a coroutine to control the spawn rate, instead of instantiate them at same time:

private IEnumerator SpawnZombies(int amount)
   int zombiesInstantiated = 0;

   while(zombiesInstantiated < amount )
      ZombieClass oneZombie = (ZombieClass)Instantiate(//*All stuff here*//);
      oneZombie.Speed = slowZombiesSpeed;
      oneZombie.Health = health;

      zombiesInstantiated ++;

      //The time for yield could decrease throught waves
      yield return new WaitForSeconds(2f);

Hope this helps you even a little.