Maybe something like a variable that counts the amount of enemies.
e.g in wave 1 there should be spawning 20 enemies. so when the variable that counts the enemies reaches 20 you stop spawning. And when it reaches 0 you go to the next wave. Then in wave 2 you stop spawning at 30 enemies and so on