Creating a Spaceship Boss Battle in Unity (Part 1)
A new enemy just appeared
Objective: Check for the wave number and show the boss
Ok so I am creating the boss enemy for the last wave in this game. My first step was to create the new boss prefab. In order to do that I duplicated the regular enemy prefab, changed the size, color and created a new script for this gameObject.
In the SpawnManager script I declared some variables. _lastWave is the number that indicates to the spawn manager what will be the last wave to start the boss battle. 2 coroutines variables to be able to stop the spawn enemy coroutines and a variable to store the boss prefab.
In the update method of the spawn manager I added an if statement to check if the current wave is lower than the last wave. In that case I just continue spanning enemies. Then if it is the last wave I check if the _boss variable is different than null then I stop the spawn enemies coroutines and instantiate the boss.
And that was the first step to create the boss.