Unity/C# Challenge 35: Enemy Shields

Challenge: create a shield for our Elite Enemy.

Now that our elite enemy is in the game, we want to add abilities beyond shooting faster. To start, we go into the prefab editor and give the enemy a shield:

Then, we modify the damage aspect of our elite enemy script:

to get this to work, we need to make sure our shield game object is set up:

we are also going to clean up our fire coroutine, by adding “while (true)” in front of the script governing it (with brackets). Now, we have an elite enemy that will spawn in with a shield capable of taking one hit and that will repeatedly fire in a burst.