Check to see if all enemy gameObjects destroyed before proceeding to next wave?

I have a very basic top down shooter game that I want to work kind of like Call of Duty nazi zombies. However, for some reason every time the last enemy spawns and I have still yet to shoot him, the game will proceed to the next wave. Here’s my code below, any help would be much appreciated
`

    GameObject enemy;
public GameObject zombieA;
public GameObject spawnPoint;
Vector3 spawnPointPos;
float respawnMinBase = 3.0f;
float respawnMaxBase = 10.0f;
float respawnMin = 3.0f;
float respawnMax = 10.0f;
float respawnInterval = 2.5f;
float enemyCount = 5f;  //Check to make sure enemies are all gone befoe preceding to next wave
float lastSpawnTime = 0;

// Use this for initialization
void Start () {
	enemy = GameObject.FindGameObjectWithTag ("Enemy");
	spawnPoint = GameObject.FindGameObjectWithTag ("Spawn");
	spawnPointPos = spawnPoint.transform.position;

	SetNextWave ();
	StartNewWave ();

}

// Update is called once per frame
void Update () {

	Debug.Log ("Wave: " + waveLevel);
	Debug.Log ("Enemies left: " + enemyCount);

	//Check for remaining enemies
	if (enemyCount <= 0) {

		Debug.Log("Wave Won!");
		spawnEnemies = false;

		if(Time.time >= waveEndTime){
		SetNextWave();
		StartNewWave();
		}
	}
	if (spawnEnemies) {
		if(Time.time > (lastSpawnTime + respawnInterval)) //wave is still going spawn enemies
		{
			SpawnEnemy();
		}
	}

}void SetNextWave(){

	waveLevel ++;
	difficultyMultiplier = ((Mathf.Pow (waveLevel, 2)) * .05f) + 1; //Up the level exponentially 
	enemyCount = 5f;
	enemyCount += difficultyMultiplier;
	respawnMin = respawnMinBase * (1 / difficultyMultiplier);
	respawnMax = respawnMaxBase * (1 / difficultyMultiplier);

}

void StartNewWave(){

	//Update GUI function

	//Spawn New Enemy function to spawn the first enemy

	//Set the wave end time
	waveEndTime = Time.time + waveLength;

	//Activate the wave
	waveActive = true;
	spawnEnemies = true;

}
void SpawnEnemy(){

	Instantiate (zombieA, spawnPointPos, Quaternion.identity);

	//Let the game an enemy is added
	enemyCount--;

	//Set the current time as the last spawn time
	lastSpawnTime = Time.time;

	//Re-randomize the respawn interval
	respawnInterval = Random.Range (respawnMin, respawnMax);

}

}`

Well there’s nothing here that check to make sure all the enemies are killed. You decrement enemyCount on line 78, so that will immediately make the if() on line 31 true.

If you have any reasonable number of enemies, and if you’ve tagged your enemies with a unique tag, you can check if they are all dead by doing a GameObject.FindGameObjectWithTag(). If it returns null, all the enemies will be dead.

first off I can’t see where ‘spawnEnemies’ is instantiated but I assume that it’s true at the start of the wave. But it seems as though you’re counting each time that a enemy is added rather than counting each time an enemy is killed.

Instantiate (zombieA, spawnPointPos, Quaternion.identity);

//Let the game an enemy is added
enemyCount--;

you should use the enemy object send a signal to this script saying that it has been killed when killed and then when that happens, subtract from the total amount of enemies left in the wave.