Making the new ammo collectable is done exactly the same way as the previous powerups, so no need to go the basics all over again. Another thing to note is that I replaced the “Ammo: “ text of the UI element to the ammo powerup’s sprite.
For the powerup to work I added a new public method AmmoCollected to the player script, which in turn is called from the powerup script once the player has collected the powerup.
This method will check if the player has used any ammo, and if they have, fill the ammo count to full and update the UI element to show this. If the player hasn’t used any ammo, the method will instead award the player hundred points.