Creating waves of enemies

Now that we are nearing the end of our game, let’s look at how to get a wave system in place so that we can have it lead up to our boss enemy. To start, we need to create some new text in our canvas to let the player know when a new wave is starting up. From there, we can go into our SpawnManager script and start adding in some new variables to work with:

From here, we are going to set our wave to 0 along with connect to our UiManager so that we can link to the new text that we have on our canvas:

Within our SpawnEnemyRoutine, we are going to add a quick line of text to let us know when our enemy count is higher:

From here, we can create a new void to work with that will control how much we spawn along with when the new waves start:

With this void, what we are going is increase our wave count, which will increase the Wave number in our UI script. For the last part of our changes to the SpawnManager script, we are going to add this new routine to the spawn void and remove our SpawnEnemyRoutine:

Finally, we will move over to our UI script and add in the method to let our player know that it has advanced to a new wave:

Now that we have all of this in place, we can take a look at our game in the editor and see how it looks:


Now that we have a wave system in place, we can look at working on our final boss of the game.