Ejemplo n.º 1
0
    /// <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());
    }
Ejemplo n.º 2
0
    /// <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]));
    }