Creating a “Zero Ammo” Negative Pickup in Unity
Leaving the player defenseless
Objective: Create a pickup and when the player collects it set the ammo to 0
For this pickup I gonna duplicate the “Hacked Movement” prefab to use the same sprite and animation and set a new power ID.
In the Player Script I create a public function to set the ammo to 0 and update the UI.
Next in the powerup script I added the new case for the power ID within it we call the function of the player script to set the ammo to 0.
In the Unity editor I selected the Spawn Manager object and added the Zero_Ammo_Prefab to the array of powerups.
And that’s it!!! The player now have to wait until collect another power to be able to attack again