removeHealth() public method

public removeHealth ( float healthToRemove ) : void
healthToRemove float
return void
Exemplo n.º 1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.tag == "PlayerBullet")
        {
            theCharacterHealth.removeHealth(other.GetComponent <BulletMovement>().bulletDamage);
        }

        if (other.gameObject.tag == "Deathzone")
        {
            gameObject.SetActive(false);
        }
    }
Exemplo n.º 2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (!GetComponent <CharacterHealth>().invincible)
        {
            if (other.gameObject.tag == "EnemyBullet")
            {
                theCharacterHealth.removeHealth(other.GetComponent <BulletMovement> ().bulletDamage);
                theCharacterHealth.Invincibility();
            }


            if (other.gameObject.tag == "Hazard")
            {
                theCharacterHealth.removeHealth(other.GetComponent <Hazard> ().damage);
                theCharacterHealth.Invincibility();
            }

            if (other.gameObject.layer == 11)
            {
                theCharacterHealth.removeHealth(1);
                theCharacterHealth.Invincibility();
            }
        }
    }