Skip to content

Instantly share code, notes, and snippets.

@curious-username
Last active October 22, 2021 02:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save curious-username/a1ae2b4b59fceaf25b4e2a763cd664d5 to your computer and use it in GitHub Desktop.
Save curious-username/a1ae2b4b59fceaf25b4e2a763cd664d5 to your computer and use it in GitHub Desktop.
Health in player
private GameObject _rightEngine, _leftEngine;
private int _lives = 3;
public void AddHealth()
{
_powerupSound.Play();
if (_lives < 3)
{
_lives++;
_uiManager.UpdateLives(_lives);
if(_lives == 2)
{
_leftEngine.SetActive(false);
}
else if(_lives == 3)
{
_rightEngine.SetActive(false);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment