/*this is the entry point for the dialogue manager*/
        private void CreateConvoButton_Click(object sender, EventArgs e)
        {
            ConversationalParamaters cParams =
                new ConversationalParamaters(ConversationalParamaters.ConversationType.helloOnly, worldManager.world.findAgentByName("John Snow"), worldManager.world.findAgentByName("Mary Jane"), worldManager.world);

            cParams.greetingMode = ConversationalParamaters.GreetingMode.fourTurn;
            cParams.farewellMode = ConversationalParamaters.FarewellMode.simple;//by default conversation type helloOnly doesnt have a farewell

            Topic t = new Topic(Topic.ExchangeTypeEnum.where);

            t.subject = worldManager.world.findByProperNoun("Westerberg Campus");

            cParams.addTopic(t);



            if (dialogueGenerator.conversation == null)
            {
                dialogueGenerator.newConversation(cParams);
            }

            //get everything off the output buffer
            while (dialogueGenerator.hasNextOutput())
            {
                updateOutput(dialogueGenerator.getOutput());
            }

            EndConvoButton.Enabled = true;
        }
Esempio n. 2
0
 IEnumerator displayDialog()
 {
     while (dialogueGenerator.hasNextOutput())
     {
         Turn   turn      = dialogueGenerator.getOutput();
         string utterance = turn.utterance;
         utterance = utterance.Replace("<agent1>", agent1.gameObject.GetComponent <AgentScript>().name);
         utterance = utterance.Replace("<agent2>", agent2.gameObject.GetComponent <AgentScript>().name);
         if ((string)(turn.participant) == "<agent1>")
         {
             agent1.gameObject.GetComponent <AgentScript>().SetCurrentPhrase(utterance);
             agent2.gameObject.GetComponent <AgentScript>().SetCurrentPhrase("");
         }
         else
         {
             agent1.gameObject.GetComponent <AgentScript>().SetCurrentPhrase("");
             agent2.gameObject.GetComponent <AgentScript>().SetCurrentPhrase(utterance);
         }
         yield return(new WaitForSeconds(turnTime));
     }
     agent1.gameObject.GetComponent <AgentScript>().SetCurrentPhrase("");
     agent2.gameObject.GetComponent <AgentScript>().SetCurrentPhrase("");
 }