Esempio n. 1
0
    void OnTriggerStay2D(Collider2D coll)
    {
        GameObject obj = coll.gameObject;

        if (obj.tag == "Bear")
        {
            BearMovement bm = obj.GetComponent <BearMovement>();
            bm.BearHasBeenHit();
        }
    }
Esempio n. 2
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        GameObject obj = coll.gameObject;

        if (goatState == (int)GoatMoveState.bashing &&
            obj.transform.position.x >= transform.position.x)
        {
            goatState = (int)GoatMoveState.returning;
            BearMovement bm = obj.GetComponent <BearMovement>();
            if (bm.BearHasBeenHit())
            {
                gameObject.GetComponent <AudioSource>().Play();
            }

            // obj.SendMessage("HandleCollisionWithGoat");
        }
    }
Esempio n. 3
0
    void OnTriggerStay2D(Collider2D coll)
    {
        GameObject obj = coll.gameObject;

        if (goatState == (int)GoatMoveState.bashing &&
            obj.transform.position.x >= transform.position.x)
        {
            goatState = (int)GoatMoveState.returning;
            BearMovement bm = obj.GetComponent <BearMovement>();
            if (bm != null)
            {
                if (bm.BearHasBeenHit())
                {
                    gameObject.GetComponent <AudioSource>().Play();
                }
            }
        }
    }