public void NewDialogue(DialogueBoxDetails details) { dialogueObject = GameObject.Instantiate(details.prefab, Vector3.zero, Quaternion.identity); dialogueObject.transform.parent = canvas.transform; dialogueObject.transform.localPosition = Vector3.zero; dialogueObject.transform.localScale = new Vector3(.75f, .75f, 1f); dialogueObject.SetActive(true); this.dialogue = dialogueObject.GetComponentInChildren <Text>(); this.dialogue.text = details.text; }
/* * public void TestDialogue1() * { * dialogueBox.NewDialogue(new DialogueBoxDetails() { dialogueString = "Hey Howdy!", displayTime = 2f }); * } * * // Makes a dialgue box for two seconds * public void ShortDialogueBox(string dialogue) * { * dialogueQueue.Add(new DialogueBoxDetails() { dialogueString = dialogue, displayTime = 2f }); * ActivateDialogueBox(); * } * * // Makes a dialogue box for three and a half seconds * public void MediumDialogueBox(string dialogue) * { * dialogueQueue.Add(new DialogueBoxDetails() { dialogueString = dialogue, displayTime = 3.5f }); * ActivateDialogueBox(); * } * * // Makes a dialogue box for 5 seconds * public void LongDialogueBox(string dialogue) * { * dialogueQueue.Add(new DialogueBoxDetails() { dialogueString = dialogue, displayTime = 6f }); * ActivateDialogueBox(); * } */ // Creates a dialogue box into the queue with the given details public void CreateDialogueBox(DialogueBoxDetails dialogueDetails) { dialogueQueue.Add(dialogueDetails); ActivateDialogueBox(); }