Ejemplo n.º 1
0
    IEnumerator Speaking(string speech, bool additive, string speaker = "", CharacterDialogueDetails.CDD dialogueDetails = null)
    {
        speechPanel.SetActive(true);

        string additiveSpeech = additive ? speechText.text : "";

        targetSpeech = additiveSpeech + speech;

        //create a new architect the very first time. Any time other than that and we renew the architect.
        if (textArchitect == null)
        {
            textArchitect = new TextArchitect(speechText, speech, additiveSpeech);
        }
        else
        {
            textArchitect.Renew(speech, additiveSpeech);
        }

        speakerNameText.text = DetermineSpeaker(speaker);//temporary
        speakerNamePane.SetActive(speakerNameText.text != "");

        //get or create a fresh set of dialogue details to make the dialogue system look a certain way for certain characters.
        string speakerValue = speakerNameText.text;

        if (speakerValue.Contains("<color="))
        {
            speakerValue = speakerValue.Split('>')[1];
        }
        if (dialogueDetails == null)
        {
            dialogueDetails = new CharacterDialogueDetails.CDD(speakerValue);
        }
        SetDialogueDetails(dialogueDetails);

        isWaitingForUserInput = false;

        if (isClosed)
        {
            OpenAllRequirementsForDialogueSystemVisibility(true);
        }

        while (textArchitect.isConstructing)
        {
            if (Input.GetKey(KeyCode.Space))
            {
                textArchitect.skip = true;
            }

            yield return(new WaitForEndOfFrame());
        }

        //text finished
        isWaitingForUserInput = true;
        while (isWaitingForUserInput)
        {
            yield return(new WaitForEndOfFrame());
        }

        StopSpeaking();
    }
Ejemplo n.º 2
0
    IEnumerator Speaking(string speech, bool additive, string speaker = "")
    {
        speechPanel.SetActive(true);

        string additiveSpeech = additive ? speechText.text : "";

        targetSpeech = additiveSpeech + speech;

        //create a new architect the very first time. Any time other than that and we renew the architect.
        if (textArchitect == null)
        {
            textArchitect = new TextArchitect(speechText, speech, additiveSpeech);
        }
        else
        {
            textArchitect.Renew(speech, additiveSpeech);
        }

        speakerNameText.text = DetermineSpeaker(speaker);//temporary?
        speakerNamePane.SetActive(speakerNameText.text != "");

        isWaitingForUserInput = false;

        if (isClosed)
        {
            OpenAllRequirementsForDialogueSystemVisibility(true);
        }

        while (textArchitect.isConstructing)
        {
            if (Input.GetKey(KeyCode.Space))
            {
                textArchitect.skip = true;
            }

            yield return(new WaitForEndOfFrame());
        }

        //text finished
        isWaitingForUserInput = true;
        while (isWaitingForUserInput)
        {
            yield return(new WaitForEndOfFrame());
        }

        StopSpeaking();
    }
Ejemplo n.º 3
0
    IEnumerator Speaking(string speech, bool additive, string speaker = "")
    {
        speechPanel.SetActive(true);

        string additiveSpeech = additive ? speechText.text : "";

        targetSpeech = additiveSpeech + speech;

        if (textArchitect == null)
        {
            textArchitect = new TextArchitect(speechText, speech, additiveSpeech);
        }
        else
        {
            textArchitect.Renew(speech, additiveSpeech);
        }


        speakerNameText.text = DetermineSpeaker(speaker);        //temporary

        speakerNamePane.SetActive(speakerNameText.text != "");

        isWaitingForUserInput = false;

        while (textArchitect.isConstructing)
        {
            if (Input.GetKey(KeyCode.Space))
            {
                textArchitect.skip = true;
            }


            yield return(new WaitForEndOfFrame());
        }

        //text finished
        isWaitingForUserInput = true;
        while (isWaitingForUserInput)
        {
            yield return(new WaitForEndOfFrame());
        }

        StopSpeaking();
    }
Ejemplo n.º 4
0
    public IEnumerator Speaking(string speech, string speaker, bool additive)
    {
        speechPanel.SetActive(true);

        string preText = additive ? speechText.text : "";

        targetSpeech = preText + speech;

        if (TextArchitect == null)
        {
            TextArchitect = new TextArchitect(speechText, speech, preText, 1, speed);
        }
        else
        {
            TextArchitect.Renew(speech, preText);
        }

        speakerNameText.text = DetermineSpeaker(speaker);
        speakerPanel.SetActive(speakerNameText.text != "");

        isWaitingForUserInput = false;

        while (TextArchitect.isConstructing)
        {
            //if (Input.GetKeyDown(KeyCode.Space))
            //{
            //    TextArchitect.skip = true;
            //}

            yield return(new WaitForEndOfFrame());
        }

        isWaitingForUserInput = true;
        while (isWaitingForUserInput)
        {
            yield return(new WaitForEndOfFrame());
        }

        StopSpeaking();
    }