private void OnTriggerExit2D(Collider2D other) { if (other.gameObject.CompareTag(Util.TagCollection.door) || other.gameObject.CompareTag(Util.TagCollection.switches) || other.gameObject.CompareTag(Util.TagCollection.enter)) { selectItem = null; touchingType = TouchingType.None; Debug.Log("取消交互"); } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag(Util.TagCollection.door)) { selectItem = other.gameObject; touchingType = TouchingType.Door; Debug.Log("交互 门"); } else if (other.gameObject.CompareTag(Util.TagCollection.switches)) { selectItem = other.gameObject; touchingType = TouchingType.Switch; Debug.Log("交互 开关"); } else if (other.gameObject.CompareTag(Util.TagCollection.enter)) { selectItem = other.gameObject; touchingType = TouchingType.Enter; Debug.Log("交互 出口"); } }