public void LifeChecker(float damage, Player player) { lifePoints -= damage; if (lifePoints <= 0) { death.Explosion(); Destroy(gameObject); } }
/// <summary> /// When the player collide with an enemy decrement his lifepoints. /// if the player doesn't have any lifepoints call the explosion function in the death component and after restart the level. /// </summary> private void LifeChecker() { lifePoints--; if (lifePoints <= 0) { death.Explosion(); GameManager.Instance.RestartLevel(); } }
public void LifeChecker(float damage, Player player) { lifePoints -= damage; if (lifePoints <= 0) { player.enemiesCounter++; SoundManager.Instance.PlaySound("EnemyDeath"); death.Explosion(); LevelManager.Instance.CheckForEndLevel(player); Destroy(gameObject); } }