Collecting multiple shield charges
Objective: Allow the player to collect up to three shields and provide visual effect for each level.
Duplicate the Player Shield twice setting all three shields to inactive.
Reduce the scale of Shield (1) and Shield (2) to respectively 1.4 and 1.0. Change sprite renderer color as shown below. Also change the order in layers to allow each shield level to stand out from each other. The Player game object is layer 4 and the engine damage is layer 5.
Add the variables below to the Player script.
The _playerShield is an array and assigned in the inspector, shown below.
ActivateShield() function increments _shields after collecting the Shield_Powerup and turns on the shield animations based on shield level.
DamagePlayer() function uses the _shields to detect when shields are active. The _shields loses a level and the animation for the highest active level shield is inactivated.