private void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Player")) { if (firstEncoutner) { gameObject.GetComponent <BoxCollider2D>().enabled = false; dialogueManager.makeDialogueTree(questIntro, wizardSprite); nodeTextLine branchingNode = dialogueManager.dialogueTree.getNodeAtIndex(3); //We hide the third option because we only want to access it through external variables branchingNode.setNumButtons(2); //These are those external variables that affect the if (currentAppleStatus == appleStatus.eaten) { branchingNode.setNextNode(2); branchingNode.setLine("So I helped you, will you help me?|Oh, Um..."); } else if (currentAppleStatus == appleStatus.gotten) { branchingNode.setNextNode(3); branchingNode.setLine("So I helped you, will you help me?|Oh, actually...!"); } dialogueManager.startDialogue(GetComponent <Collider2D>()); firstEncoutner = false; //Shrink the box back down after the player has ran into him the first time. GetComponent <BoxCollider2D>().size = new Vector2(5.5f, 6.5f); GetComponent <BoxCollider2D>().offset = new Vector2(0f, 0f); } } }