Example #1
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
            }
        }
    }
    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();
    }