示例#1
0
    void OnCollisionStay2D(Collision2D coll)
    {
        Vector2 collPos = coll.gameObject.transform.position;
        Vector2 rbPos   = rigid_fire.position;


        if (coll.gameObject.tag == "goomba" || coll.gameObject.tag == "KoopaTroopa")
        {
            gC.add_coin();
            gC.addScore(200);
            gC.subFireCount(1);
            Destroy(coll.gameObject);
            Destroy(this.gameObject);
        }
        foreach (ContactPoint2D hitPos in coll.contacts)
        {
            if (hitPos.normal.y > 0)
            {
                col_bottom = true;
            }

            if (hitPos.normal.x != 0)
            {
                gC.subFireCount(1);
                Destroy(this.gameObject);
            }
        }
    }
示例#2
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "lava")
        {
            dead = true;
            Destroy(this.gameObject);
        }

        if (coll.gameObject.tag == "MariosFireball")
        {
            //Physics2D.IgnoreCollision (coll.collider, coll.otherCollider);
            hp--;
            Debug.Log("Bowser HP was reduced!");
            if (hp <= 0)
            {
                dead = true;
                Debug.Log("Bowser HP hit 0, it must die!");
                Destroy(this.gameObject);
            }
            gC.subFireCount(1);
            Destroy(coll.gameObject);
        }
    }