Esempio n. 1
0
    IEnumerator speechProcess(SpeechSequence s)
    {
        st.stopST();
        SpeechInstance speech = new SpeechInstance();

        while (!s.isDone())
        {
            speech = s.getNext();

            // Output speech
            if (speech.c1Speaker)
            {
                c1.companionSpeechController.say(speech.message, speech.lifetime);
            }
            else
            {
                c2.companionSpeechController.say(speech.message, speech.lifetime);
            }

            yield return(new WaitForSeconds(speech.replyTime)); //Wait for finishing talking
        }
        yield return(new WaitForSeconds(speech.replyTime));

        st.startST();
    }
Esempio n. 2
0
    IEnumerator smallTalkProcess()
    {
        while (smallTalkEnabled)
        {
            yield return(new WaitForSeconds(Random.Range(delayMin, delayMax))); // Wait for next small talk

            int randomInt = Random.Range(0, c1Sequences.Count);
            print(c1Sequences.Count);
            SpeechSequence sequence = c1Sequences[randomInt];

            while (!sequence.isDone())
            {
                SpeechInstance speech = sequence.getNext();

                // Output speech
                if (speech.c1Speaker)
                {
                    c1.companionSpeechController.say(speech.message, speech.lifetime);
                }
                else
                {
                    c2.companionSpeechController.say(speech.message, speech.lifetime);
                }

                yield return(new WaitForSeconds(speech.replyTime)); //Wait for finishing talking
            }
        }
    }
Esempio n. 3
0
    public void playSequence(string name)
    {
        if (!sequences.ContainsKey(name))
        {
            return;
        }

        SpeechSequence s = sequences[name];

        StartCoroutine(speechProcess(s));
    }