Exemple #1
0
    public void DisplayNextSentence()
    {
        if (points.Count == 0)
        {
            if (choicePresent)
            {
                DisplayChoice();
                return;
            }
            if (nextDialog)
            {
                Invoke("DoNextDialog", 1);
            }
            EndDialog();
            return;
        }

        DialogPoints dialogPoint = points.Peek();

        if (isTyping == false)
        {
            StopAllCoroutines();
            StartCoroutine(TypeSentence(dialogPoint));
            return;
        }
        StopAllCoroutines();
        dialogText.text = "";
        dialogText.text = dialogPoint.sentence;
        isTyping        = false;
        points.Dequeue();
    }
Exemple #2
0
    IEnumerator TypeSentence(DialogPoints dialogPoint)
    {
        isTyping = true;
        characterImage.sprite         = dialogPoint.characterImage;
        characterImage.preserveAspect = true;
        characterImageAnimator.SetInteger("sideInt", dialogPoint.sideInt);
        nameText.text   = dialogPoint.name;
        dialogText.text = "";
        foreach (char letter in dialogPoint.sentence.ToCharArray())
        {
            dialogText.text += letter;
            yield return(new WaitForSeconds(.02f));

            speakAudio.Play();
        }
        isTyping = false;
        if (points.Count > 0 || !choicePresent)
        {
            points.Dequeue();
        }
    }