Exemple #1
0
    IEnumerator FadingText(XElement convo)
    {
        TextBoxManager.player.DisablePartyMovement();
        fadeText.gameObject.SetActive(true);
        convoRunning = true;
        yield return(new WaitForSeconds(1));

        var lines = XMLLoader.GetLines(convo);

        foreach (XElement line in lines)
        {
            yield return(new WaitForSeconds(1));

            fadeText.text = XMLLoader.GetSpeakerDialog(line);
            Color textColor = fadeText.color;
            for (int i = 0; i < 20; i++)
            {
                textColor.a   += .05f;
                fadeText.color = textColor;
                yield return(null);
            }
            yield return(new WaitForSeconds(2));

            for (int i = 0; i < 20; i++)
            {
                textColor.a   -= .05f;
                fadeText.color = textColor;
                yield return(null);
            }
        }
        yield return(new WaitForSeconds(1));

        convoRunning     = false;
        fadeText.enabled = false;
    }
Exemple #2
0
    IEnumerator PlayingConvo(XElement convo, bool yesNoChoice = false)
    {
        yesNoPicked  = false;
        convoRunning = true;
        endLine      = 0;
        var lines = XMLLoader.GetLines(convo);

        foreach (XElement line in lines)
        {
            EnableTextBox(XMLLoader.GetSpeakerDialog(line), false);
            yield return(null);

            while (isTyping)
            {
                yield return(null);
            }
            if (yesNoChoice)
            {
                yesNoOptions.SetActive(true);
                cursor.SetActive(true);
                UpdateCursor(0);
                //After the text is displayed, give the player two options: yes and no. Each triggers a different cutscene.
                while (!yesNoPicked)
                {
                    CheckInputSimple();
                    yield return(null);
                }
            }
            else
            {
                while (!Input.GetButtonDown("AButton"))
                {
                    yield return(null);
                }
            }
        }
        convoRunning = false;
    }