void OnTriggerStay2D(Collider2D coll) { GameObject obj = coll.gameObject; if (obj.tag == "Bear") { BearMovement bm = obj.GetComponent <BearMovement>(); bm.BearHasBeenHit(); } }
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"); } }
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(); } } } }