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);
     }
 }
Пример #2
0
 public void SetHealth()
 {
     _healtbar.SetHealth(_unitStatistics.currentHp, _unitStatistics.maxHp);
 }