Exemplo n.º 1
0
    public void TakeDamage(int damage)
    {
        //player animation
        m_animator.SetTrigger("Hurt");
        //take into account the armor
        damage     -= armor.GetVal();
        damage      = Mathf.Clamp(damage, 0, int.MaxValue);
        currHealth -= damage;
        healthBar.SetHealth(currentHealth);

        if (currHealth <= 0)
        {
            Die();
        }
    }