/// <summary> /// Typing animation of the dialogue. /// </summary> /// <param name="dialogueSO">Dialogue data</param> IEnumerator TypeLine(Dialogue_ScriptObject dialogueSO) { foreach (char c in dialogueSO.dialogue.ToCharArray()) { message.text += c; yield return(new WaitForSeconds(1f / textSpeed)); } //if it was not interrupted, set the needed button status neededButtonStatus = !buttonDown; waitCoroutine = StartCoroutine(WaitForTap()); }
/// <summary> /// Starts the typing of the dialogue. /// </summary> void StartDialogue() { currentDialogue = dialogues[dialogueIndex]; //sets the name, image and the message charImage.sprite = currentDialogue.characterImage; charName.text = currentDialogue.characterName; message.text = ""; //starts the typing typingCoroutine = StartCoroutine(TypeLine(dialogues[dialogueIndex])); }