Example #1
0
    public void TakeDamage(int damage)
    {
        Health -= damage;
        healthBar.DecreasingHealth(damage);
        if (Health <= 0)
        {
            if (onPlayerDestroy != null)
            {
                onPlayerDestroy();
            }

            Destroy(gameObject, 0.1f);
        }
    }
Example #2
0
    public void TakeDamage(int damage)
    {
        if (!DamageSensitive)
        {
            damage = 0;
        }

        Health -= damage;
        if (Health <= 0)
        {
            Destroy(gameObject, 0.1f);
        }
        else
        {
            healthBar.DecreasingHealth(damage);
        }
    }