public void TakeDamage(float amount)
 {
     //on prend es degats
     currentHealth -= amount;
     if (currentHealth <= 0) //le player est mort
     {
         currentHealth = 0;
         StartCoroutine(Die());
     }
     //on update la barre de vie
     healthBar.UpdateHealthBar(currentHealth, maxHealth);
 }
示例#2
0
        public void TakeDamage(int damageRecivied)
        {
            _currentHealth          -= damageRecivied;
            _healthBar.Maxhealth     = _maxHealth;
            _healthBar.CurrentHealth = _currentHealth;

            if (_currentHealth < 0)
            {
                _currentHealth = 0;
            }

            _healthBar.UpdateHealthBar();
        }