예제 #1
0
    public void DequeueDialogue()      //shows dialogue
    {
        if (isCurrentlyTyping == true) //autocompletes text
        {
            CompleteText();
            StopAllCoroutines();
            isCurrentlyTyping = false;
            return;
        }

        if (dialogueInfo.Count == 0)
        {
            EndOfDialogue();
            return;
        }


        Dialogue.Info info = dialogueInfo.Dequeue();
        completeText = info.myText;

        dialogueName.text = info.name;


        pullTextUrl(info);

        dialogueText.text       = info.myText;
        dialoguePortrait.sprite = info.portrait;
        dialogueText.text       = "";
        StartCoroutine(TypeText(info));
    }
예제 #2
0
    IEnumerator TypeText(Dialogue.Info info)
    {
        isCurrentlyTyping = true;
        foreach (char c in info.myText.ToCharArray())
        {
            yield return(new WaitForSeconds(delay));

            dialogueText.text += c;
        }
        isCurrentlyTyping = false;
    }
예제 #3
0
    IEnumerator pullTextUrl(Dialogue.Info info)
    {
        //Disable annoying obsolete warning
        #pragma warning disable 0618

        WWW www = new WWW(info.url);
        yield return(www);

        string text = www.text;
        info.myText = text;

        //Restore warnings
        #pragma warning restore 0618
    }
예제 #4
0
    public void DisplayNextSentence()
    {
        if (portrait != null)
        {
            portrait.SetActive(false);
        }

        if (dialogueInfo.Count == 0)
        {
            EndDialogue();
            return;
        }
        Dialogue.Info info = dialogueInfo.Dequeue();

        portrait = info.portrait;
        string sentence = info.sentences; //sentences.Dequeue();

        portrait.SetActive(true);
        StopAllCoroutines();
        StartCoroutine(TypeSentence(sentence));
        Time.timeScale = 0f;
    }