Esempio n. 1
0
    public void TakeDamage(int damage)
    {
        tintColor.SetTintColor(new Color(255, 0, 0, 255));
        currentHealth -= damage;

        if (currentHealth <= 0)
        {
            Die();
        }
    }
Esempio n. 2
0
    public void TakeDamage(int damage)
    {
        tintColor.SetTintColor(new Color(255, 0, 0, 255));
        currentHealth -= damage;

        if (healthBar != null)
        {
            healthBar.SetHealth(currentHealth);
        }

        if (currentHealth <= 0 && !isDead)
        {
            Die();
            Debug.Log("the player has been slayed");
        }
    }