void Update() { if (gameObject.tag == "EnemyBullet") { TakeDamage(20); PlayerHit.Play(); } if (gameObject.tag == "Enemy") { TakeDamage(20); PlayerHit.Play(); } healthbar.SetHealth(currentHealth); if (currentHealth == 0) { Destroy(gameObject); GameOver.SetActive(true); } }
public void SetHealth() { _healtbar.SetHealth(_unitStatistics.currentHp, _unitStatistics.maxHp); }