//private void OnCollisionStay2D(Collision2D collision) //{ // if (collision.gameObject.tag == gameObject.tag) // { // TriggerCheck = collision.gameObject.GetComponent<triggerCheck>(); // isSame = true; // } //} private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.tag == gameObject.tag) { TriggerCheck = collision.gameObject.GetComponent <triggerCheck>(); isSame = true; } }
//private void OnTriggerStay2D(Collision2D collision) //{ // Debug.Log("rightSame"); // if (collision.gameObject.tag == gameObject.tag) // { // TriggerCheck = collision.gameObject.GetComponent<triggerCheck>(); // isSame = true; // } //} private void OnTriggerEnter2D(Collider2D collision) { Debug.Log("rightTouched"); if (collision.gameObject.tag == gameObject.tag) { TriggerCheck = collision.gameObject.GetComponent <triggerCheck>(); isSame = true; } }
//private void OnCollisionStay2D(Collision2D collision) //{ // if (collision.gameObject.tag == gameObject.tag) // { // TriggerCheck = collision.gameObject.GetComponent<triggerCheck>(); // isSame = true; // } //} private void OnTriggerStay2D(Collider2D collision) { if (collision.gameObject.tag == tag) { Debug.Log("downTouched"); TriggerCheck = collision.gameObject.GetComponent <triggerCheck>(); isSame = true; } }
private void OnTriggerEnter(Collider other) { if (other.tag == "Items") { triggerCheck trigger = gameObject.GetComponent <triggerCheck>(); trigger.Triggered = true; Interactable interactable = other.GetComponent <Interactable>(); if (interactable != null) { SetFocus(interactable); } } }
private void OnTriggerExit(Collider other) { triggerCheck trigger = gameObject.GetComponent <triggerCheck>(); trigger.Triggered = false; }