2D Galaxy Shooter: Health Collectable
Health PowerUp that heals the player by 1…!!
In our 2D Galaxy Shooter, player firing laser to enemies and enemies back fires to player and during the play of course — Player loses its life..Currently there is no way for player back to game if player looses all lives
For these situation added additional feature— thats we call Health Powerup that provide player back 1 life or heals the player by 1.
Health Powerup can be created using Prefab- Health_Powerup referenced in Powerup.cs script and set the properties in inspector such as Powerup ID =4 speed, audio clip etc same way as we did in last power up Ammo_PowerUp
In Powerup.cs script it will call OnTriggerEnter2D() method when Player collided with the powerup health collectable having _powerupID =4 it will communicate with the Player.cs script call the method having player reference player.HealthPowerUpActive() as below
In Player.cs script, where the purpose of HealthPowerUpActive() logic to update the health of the player live, update the engine left or right accordingly communicate back to UIManager.cs script, so that it will display on UI Canvas.