public void startText(GameHandler gHandler, Storage storage, GameEvent gEvent, string text, float time) { this.gHandler = gHandler; this.storage = storage; this.gEvent = gEvent; // Initializes both lists. for (int i = 0; i < 99; i++) { textList[i] = ""; displayList[i] = ""; } // Initializes all variables. line = 0; maxLines = 0; deltaTime = 0; stop = false; active = false; // Sets the dialogue handler for the game handler. gHandler.setDialogueHandler(this); // Starts the dialogue event after the given time. StartCoroutine(startDialogue(text, time)); }
// Sets all relevant sprites' positions to zero. private void endText() { // Clear all remaining coroutines. StopAllCoroutines(); // Sets text to no value. Text dText1 = (Text)dialogue1.GetComponent(typeof(Text)); dText1.text = ""; Text dText2 = (Text)dialogue2.GetComponent(typeof(Text)); dText2.text = ""; text = ""; // Moves text box out of the way. textbox.transform.position = new Vector3(-50, -50, 0); // Sets active to false, disallowing updates. active = false; // Sets game handler to no longer receive input from this handler. gHandler.setDialogueHandler(null); }