Objective: Add the boss to the wave system and the spawn manager.
We have created a boss enemy. It attacks our player in a new way. It can be destroyed, and it’s a lot more difficult than the other enemies. Now we need to add the boss enemy to the wave system so the game will spawn the boss enemy.
We need to add the boss enemy to the spawn manager list of enemies.
In the spawn manager script, navigate to the method that handles with what type of enemy to spawn. I use if statements to control what wave number spawn what enemy. So, for instance, if the wave number is seven, we want the enemy id to be our boss enemy id.
The spawn manager now knows that enemy to spawn when the wave count reaches seven. What it doesn’t know yet is how many enemies to spawn so we need to go to the method that controls the wave count. We have a switch statement set up to control this, we need to add a case for wave seven.
Now, the spawn manager will spawn one boss enemy when the wave count reaches seven. We need to navigate to the method that controls when to call a new wave.
Opening the UI script, we need to create a method to handle the boss wave. To be honest, the boss wave method I created is identical to the new wave method, I just really wanted a special method for the boss enemy.
That is all there is to it. The wave system has successfully been updated. When the player battels his way through six waves, he will be approached by the boss enemy and the boss battle will commence.
This is a good end point for creating a boss character, however, I have one more tutorial coming up to cover adding damage animations to the boss enemy. As I always say, don’t be afraid to experiment with your code, and I’ll see you in the next tutorial.