Ejemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.tag == "coin")
        {
            print("Get Coin");

            coin++;
            Destroy(other.gameObject);
        }
        else if (other.gameObject.tag == "enemy")
        {
            PS.Chp -= other.gameObject.GetComponent <enemy>().damage;
            healthBar.sliderhealth(health);
            PS.cancelHp();
        }
        else if (other.gameObject.tag == "enemybullet")
        {
            PS.Chp -= other.gameObject.GetComponent <bullet>().damage;
            healthBar.sliderhealth(health);
            PS.cancelHp();
        }
    }