Part 2— Fire & Forget: Creating a Smart Homing Missile for your Unity Game Project!

Objective: Implement a new weapon to your player’s arsenal in your Unity 2D Game Project. Make it smart. It should be able to detect, track and destroy any enemy game objects present in the game scene.

Part 2 — Creating the collectible Power-Up to arm the Player with Homing Missiles.

RotatingObject scrip ~ allows a Game Object to rotate along its Z-axis at a given speed.
PowerUps script ~ add the 6th Power Up, setting its ID to 5 in the comments.
PowerUps script ~ Adjusting the Case logic to call the PlayerHomingMissiles() method when the Power Up ID equals 5.
SpawnManager script ~ setting the int randomPowerUp random range between 0 and 6.
PlayerScript ~ PlayerHomingMissiles() method adding 5 missiles to the total count, capping it at 25, updating the UI, and ensuring the bool is set to True.
UI Text switches to red color to show depleted Homing Missile stores, green when some remain in the Player’s inventory.
Player collecting the Homing Missile Power Up.