//Determines what trigger the player is leave to remove them as needed private void OnTriggerExit2D(Collider2D collision) { if (collision.gameObject.CompareTag("PickUp")) { if (collision.gameObject == pickUp) { pickUp = null; } } if (collision.gameObject.CompareTag("Interactable")) { if (collision.gameObject == interactable) { interactable = null; t.text = ""; tImage.enabled = false; } } if (collision.gameObject.CompareTag("Elevator")) { if (collision.gameObject.GetComponent <ElevatorTeleporter>() == elevator) { elevator = null; } } }
//Determines what trigger the player has hit and stores them as needed private void OnTriggerEnter2D(Collider2D collision) { if (collision.gameObject.CompareTag("PickUp")) { pickUp = collision.gameObject; } if (collision.gameObject.CompareTag("Interactable")) { interactable = collision.gameObject; t.text = collision.gameObject.GetComponent <Interact>().hint; tImage.enabled = true; } if (collision.gameObject.CompareTag("Elevator")) { elevator = collision.gameObject.GetComponent <ElevatorTeleporter>(); } }