Phase I: Ammo Collectible

In my previous article, I set up an ammo limit of 15 for the player and a notification when the ammo is depleted. If it is left like that, it would be pretty difficult for the player to survive once they run out of ammo.

So the next objective is to create a collectible to replenish the player’s ammo.

The first thing is to create another method for the player to call when the new collectible is picked up. So in the Player script, I’m creating a method called AmmoCollected(). It will use the existing variables for _currentAmmo and _maxAmmo created in the…