public void PlayerReplyTurn() { var playerAgent = rpcList.Find(x => x.CharacterName == _chosenCharacter); var decidedList = playerAgent.Decide(); var action = decidedList.FirstOrDefault(); IEnumerable <DialogueStateActionDTO> availableDialogs = new DialogueStateActionDTO[1]; List <DialogueStateActionDTO> dialogs = new List <DialogueStateActionDTO>(); stopTime = true; Name currentState = action.Parameters[0]; Name nextState = action.Parameters[1]; Name meaning = action.Parameters[2]; Debug.Log(" meaning: " + meaning); Name style = Name.BuildName("*"); dialogs = _iat.GetDialogueActions(currentState, nextState, meaning, style); //Debug.Log(" dialog: " + dialogs.Count + " first: " + dialogs[0].Utterance); availableDialogs = dialogs; UpdateButtonTexts(false, availableDialogs); }
private void buttonAddOrUpdate_Click(object sender, EventArgs e) { try { var newDA = new DialogueStateActionDTO { CurrentState = textBoxCurrentState.Value.ToString(), NextState = textBoxNextState.Value.ToString(), Meaning = textBoxMeaning.Value.ToString(), Style = textBoxStyle.Value.ToString(), Utterance = textBoxUtterance.Text }; if (dto.Id == Guid.Empty) { UpdatedGuid = asset.AddDialogAction(newDA); } else { UpdatedGuid = asset.EditDialogAction(dto, newDA); } this.Close(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Test_IAT_GetDialogueActionById() { var iat = Build_IAT_Asset(); var id = new Guid(); var d = new DialogueStateActionDTO() { CurrentState = "Start", Meaning = "-", NextState = "S1", Style = "-", Utterance = "sbahh", Id = id, UtteranceId = "1" }; iat.AddDialogAction(d); var trueID = iat.GetAllDialogueActions().FirstOrDefault().Id; var err = ""; Assert.AreEqual(iat.GetDialogActionById(trueID).CurrentState, d.CurrentState); }
private static IEnumerable <DialogueStateActionDTO> ImportWorkSheet(ExcelPackage package, string workSheetName) { var worksheet = package.Workbook.Worksheets[workSheetName]; if (worksheet == null) { throw new Exception($"Could not find worksheet with the name \"{workSheetName}\""); } var lastRow = worksheet.Dimension.End.Row; var cells = worksheet.Cells; for (int i = 3; i <= lastRow; i++) { var rowValues = Enumerable.Range(1, 5).Select(j => cells[i, j].Text).ToArray(); if (rowValues.All(string.IsNullOrEmpty)) { continue; } var value = new DialogueStateActionDTO() { CurrentState = rowValues[0], NextState = rowValues[1], Meaning = rowValues[2], Style = rowValues[3], Utterance = rowValues[4] }; yield return(value); } }
private void UpdateFeedbackScores(DialogueStateActionDTO reply, string agent) { var chat = new ChatObject { Utterence = Localization.GetAndFormat(reply.FileName, false, ScenarioCode), Agent = agent, CurrentState = reply.CurrentState, NextState = reply.NextState, FileName = reply.FileName, UtteranceId = reply.UtteranceId, DialogueId = reply.Id }; if (CurrentScenario.Prefix != "Questionnaire") { _chatScoreHistory.Add(new ChatScoreObject { ChatObject = chat, Scores = new Dictionary <string, int>() }); UpdateScore(reply); foreach (var chatScore in _chatScoreHistory.Last().Scores) { if (_feedbackScores.ContainsKey(chatScore.Key)) { _feedbackScores[chatScore.Key] = chatScore.Value; } else { _feedbackScores.Add(chatScore.Key, chatScore.Value); } } } }
/// <summary> /// Adds a new dialogue action /// </summary> /// <param name="dialogueStateActionDTO">The action to add.</param> public Guid AddDialogAction(DialogueStateActionDTO dialogueStateActionDTO) { var newDA = new DialogStateAction(dialogueStateActionDTO); m_dialogues.AddDialog(newDA); return(newDA.Id); }
/// <summary> /// Updates an existing dialogue action for the player /// </summary> /// <param name="dialogueStateActionToEdit">The action to be updated.</param> /// <param name="newDialogueAction">The updated action.</param> public Guid EditDialogAction(DialogueStateActionDTO dialogueStateActionToEdit, DialogueStateActionDTO newDialogueAction) { var id = this.AddDialogAction(newDialogueAction); this.RemoveDialogueActions(new[] { dialogueStateActionToEdit }); return(id); }
public void Test_IAT_GetAllDialogueAction() { var iat = Build_IAT_Asset(); var id = new Guid(); var d = new DialogueStateActionDTO() { CurrentState = "Start", Meaning = "-", NextState = "S1", Style = "-", Utterance = "sbahh", Id = id, UtteranceId = "1" }; var id2 = new Guid(); var d2 = new DialogueStateActionDTO() { CurrentState = "S1", Meaning = "-", NextState = "S2", Style = "-", Utterance = "sbahh", Id = id2, UtteranceId = "1" }; iat.AddDialogAction(d); iat.AddDialogAction(d2); Assert.AreEqual(iat.GetAllDialogueActions().Count(), 2); }
public MultiCharacterAgentController(SingleCharacterDemo.ScenarioData scenarioData, RolePlayCharacterAsset rpc, IntegratedAuthoringToolAsset iat, UnityBodyImplement archetype, Transform anchor, DialogController dialogCrt) { m_scenarioData = scenarioData; m_iat = iat; m_rpc = rpc; m_dialogController = dialogCrt; _body = GameObject.Instantiate(archetype); UnityEngine.Random.InitState((int)System.DateTime.Now.Ticks); var r = UnityEngine.Random.Range(0, 600); _body.GetComponentInChildren <Animator>().Play(0, -1, r); _body.tag = rpc.CharacterName.ToString(); just_talked = false; lastAction = null; var t = _body.transform; t.SetParent(anchor, false); t.localPosition = Vector3.zero; t.localRotation = Quaternion.identity; t.localScale = Vector3.one; HeadLookController head = _body.GetComponentInChildren <HeadLookController>(); head._target = GameObject.FindGameObjectWithTag("MainCamera"); m_dialogController.SetCharacterLabel(m_rpc.CharacterName.ToString()); // m_rpc.Perceive(new Name[] { EventHelper.PropertyChange("DialogueState(Player)", "Start", "world") }); lastDialog = new DialogueStateActionDTO(); }
public PostRaceEventState(CrewMember crewMember, DialogueStateActionDTO dialogue, List <string> subs = null) { if (subs == null) { subs = new List <string>(); } CrewMember = crewMember; Dialogue = dialogue; Subjects = subs; }
/// <summary> /// Creates a new instance of a dialogue action from the corresponding DTO /// </summary> public DialogStateAction(DialogueStateActionDTO dto) { this.Id = dto.Id == Guid.Empty?Guid.NewGuid() : dto.Id; this.CurrentState = Name.BuildName(dto.CurrentState); this.Meaning = Name.BuildName(dto.Meaning); this.Style = Name.BuildName(dto.Style); this.NextState = Name.BuildName(dto.NextState); this.Utterance = dto.Utterance; this.UtteranceId = dto.UtteranceId; }
public void UpdateScore(DialogueStateActionDTO reply) { foreach (var meaning in reply.Meaning) { HandleKeywords("" + meaning); } foreach (var style in reply.Style) { HandleKeywords("" + style); } }
public void UpdateScore(DialogueStateActionDTO reply) { foreach (var meaning in reply.Meaning) { HandleKeywords(meaning.ToString()); } foreach (var style in reply.Style) { HandleKeywords(style.ToString()); } }
private void auxAddOrUpdateItem(DialogueStateActionDTO item) { var diag = new AddOrEditDialogueActionForm(LoadedAsset, item); diag.ShowDialog(this); if (diag.UpdatedGuid != Guid.Empty) { _dialogs.DataSource = LoadedAsset.GetAllDialogueActions().ToList(); EditorTools.HighlightItemInGrid <DialogueStateActionDTO> (dataGridViewDialogueActions, diag.UpdatedGuid); } SetModified(); }
/// <summary> /// Update the responsse text for the crew member /// </summary> public void UpdateDialogue(DialogueStateActionDTO response, List <string> subjects) { if (response != null) { subjects = subjects.Select(s => Localization.HasKey(s) ? Localization.Get(s) : Regex.Replace(s, @"((?<=\p{Ll})\p{Lu})|((?!\A)\p{Lu}(?>\p{Ll}))", " $0")).ToList(); _dialogueText.text = Localization.GetAndFormat(response.Utterance, false, subjects.ToArray()); LastState = response.CurrentState; if (response.Style.Length > 0) { foreach (var style in response.Style.Split('_').Where(sp => !string.IsNullOrEmpty(sp)).ToArray()) { var impactSubjects = new List <string>(subjects); impactSubjects.Insert(0, CurrentCrewMember.Name); UIManagement.EventImpact.AddImpact(style, impactSubjects); } } } }
private void buttonDuplicateDialogueAction_Click(object sender, EventArgs e) { if (dataGridViewDialogueActions.SelectedRows.Count == 1) { var item = ((ObjectView <DialogueStateActionDTO>)dataGridViewDialogueActions.SelectedRows[0] .DataBoundItem).Object; var newDialogueAction = new DialogueStateActionDTO { CurrentState = item.CurrentState, NextState = item.NextState, Meaning = item.Meaning, Style = item.Style, Utterance = item.Utterance }; LoadedAsset.AddDialogAction(newDialogueAction); RefreshDialogs(); } }
public AddOrEditDialogueActionForm(IntegratedAuthoringToolAsset asset, DialogueStateActionDTO dto) { InitializeComponent(); this.dto = dto; this.asset = asset; textBoxCurrentState.Value = (WellFormedNames.Name)dto.CurrentState; textBoxNextState.Value = (WellFormedNames.Name)dto.NextState; textBoxMeaning.Value = (WellFormedNames.Name)dto.Meaning; textBoxStyle.Value = (WellFormedNames.Name)dto.Style; textBoxUtterance.Text = dto.Utterance; //validators EditorTools.AllowOnlyGroundedLiteralOrNil(textBoxCurrentState); EditorTools.AllowOnlyGroundedLiteralOrNil(textBoxNextState); textBoxMeaning.AllowVariable = false; textBoxStyle.AllowVariable = false; }
public void Test_IAT_GetDialogueActionsByState() { var iat = Build_IAT_Asset(); var id = new Guid(); var d = new DialogueStateActionDTO() { CurrentState = "Start", Meaning = "-", NextState = "S1", Style = "-", Utterance = "sbahh", Id = id, UtteranceId = "1" }; iat.AddDialogAction(d); Assert.AreEqual(iat.GetDialogueActionsByState("Start").FirstOrDefault().Utterance, d.Utterance); }
public void Test_IAT_EditDialogueAction() { var iat = Build_IAT_Asset(); var id = new Guid(); var d = new DialogueStateActionDTO() { CurrentState = "Start", Meaning = "-", NextState = "S1", Style = "-", Utterance = "sbahh", Id = id, UtteranceId = "1" }; var id2 = new Guid(); var d2 = new DialogueStateActionDTO() { CurrentState = "S1", Meaning = "-", NextState = "S2", Style = "-", Utterance = "aaaaaaaa", Id = id2, UtteranceId = "1" }; iat.AddDialogAction(d); var newD = iat.GetAllDialogueActions().FirstOrDefault(); iat.EditDialogAction(newD, d2); Assert.AreEqual(iat.GetAllDialogueActions().FirstOrDefault().CurrentState.ToString(), d2.CurrentState.ToString()); }
/// <summary> /// Save the notes for this crew member or position /// </summary> public void SaveNote(string subject, string note) { var newNote = new DialogueStateActionDTO { CurrentState = "Player_Note", NextState = subject.NoSpaces(), Meaning = Name.NIL_STRING, Style = Name.NIL_STRING, Utterance = note }; var savedNote = iat.GetDialogueActionsByState("Player_Note").FirstOrDefault(s => s.NextState == subject.NoSpaces()); if (savedNote == null) { iat.AddDialogAction(newNote); } else { iat.EditDialogAction(savedNote, newNote); } iat.Save(); }
private DialogueStateActionDTO GenerateDialogueActionFromLine(string line, int totalSize, ref int stateCounter) { line = line.Replace("A:", ""); char[] delimitedchars = { '\n' }; line = line.Trim(); var result = line.Split(delimitedchars); var currentState = ""; var nextState = ""; if (stateCounter == 0) { currentState = IATConsts.INITIAL_DIALOGUE_STATE; stateCounter += 1; nextState = "S" + stateCounter; } else { currentState = "S" + stateCounter; stateCounter += 1; nextState = "S" + stateCounter; } if (stateCounter == totalSize) { nextState = "End"; } var add = new DialogueStateActionDTO() { CurrentState = currentState, NextState = nextState, Utterance = result[0], }; return(add); }
public void Test_IAT_DP_ValidDialogue_NoMatch(string context, string lastEventMethodCall) { var iat = Build_IAT_Asset(); var id = new Guid(); var d = new DialogueStateActionDTO() { CurrentState = "Start", Meaning = "-", NextState = "S1", Style = "-", Utterance = "sbahh", Id = id, UtteranceId = "1" }; var id2 = new Guid(); var d2 = new DialogueStateActionDTO() { CurrentState = "S1", Meaning = "-", NextState = "S2", Style = "Rude", Utterance = "ssadasdasdh", Id = id2, UtteranceId = "2" }; iat.AddDialogAction(d); iat.AddDialogAction(d2); // iat.AddNewCharacterSource(new CharacterSourceDTO(){}); var rpc = BuildRPCAsset(); // Associating IAT to RPC iat.BindToRegistry(rpc.DynamicPropertiesRegistry); // Making sure the RPC is well Initialized rpc.Perceive(EventHelper.ActionEnd("Sarah", "EnterRoom", "Matt")); rpc.Perceive(EventHelper.ActionEnd("Sarah", "Speak(S3,S4,Polite, Rude)", "Matt")); // Initializing var condSet = new ConditionSet(); var cond = Condition.Parse("[x] = True"); IEnumerable <SubstitutionSet> resultingConstraints = new List <SubstitutionSet>(); if (context != "") { var conditions = context.Split(','); cond = Condition.Parse(conditions[0]); // Apply conditions to RPC foreach (var res in conditions) { cond = Condition.Parse(res); condSet = condSet.Add(cond); } resultingConstraints = condSet.Unify(rpc.m_kb, Name.SELF_SYMBOL, null); } condSet = new ConditionSet(); cond = Condition.Parse(lastEventMethodCall); condSet = condSet.Add(cond); var result = condSet.Unify(rpc.m_kb, Name.SELF_SYMBOL, resultingConstraints); Assert.IsEmpty(result); }
private void HandleEffects(IAction action, RolePlayCharacterAsset actor, DialogueStateActionDTO dialog) { if (LoadedAsset.m_worldModelSource == null) { return; } if (LoadedAsset.m_worldModelSource.Source == null) { return; } if (LoadedAsset.m_worldModelSource.Source == "") { return; } var wm = WorldModelAsset.LoadFromFile(LoadedAsset.m_worldModelSource.Source); var target = action.Target; var toString = "Speak(" + dialog.CurrentState + "," + dialog.NextState + "," + dialog.Meaning + "," + dialog.Style + ")"; var ev = EventHelper.ActionEnd(actor.CharacterName.ToString(), toString, target.ToString()); foreach (var a in agentsInChat) { a.Perceive(ev); } var effects = wm.Simulate(new[] { ev }); string toWrite = ""; toWrite += "Effects: \n"; Dictionary <string, List <string> > observerAgents = new Dictionary <string, List <string> >(); foreach (var eff in effects) { var evt = EventHelper.PropertyChange(eff.PropertyName.ToString(), eff.NewValue.ToString(), actor.CharacterName.ToString()); foreach (var a in agentsInChat) { if (eff.ObserverAgent == a.CharacterName || eff.ObserverAgent.ToString() == "*") { if (!observerAgents.ContainsKey(a.CharacterName.ToString())) { observerAgents.Add(a.CharacterName.ToString(), new List <string>() { evt.GetNTerm(3).ToString() }); } else { observerAgents[a.CharacterName.ToString()].Add(evt.GetNTerm(3).ToString()); } a.Perceive(evt); } } } foreach (var o in observerAgents) { toWrite += o.Key + ": "; foreach (var e in o.Value) { var value = agentsInChat.Find(x => x.CharacterName.ToString() == o.Key).GetBeliefValue(e); toWrite += e + " = " + value + ", "; } toWrite = toWrite.Substring(0, toWrite.Length - 2); toWrite += "\n"; } if (effects.Any()) { textBoxBelChat_TextChanged(null, null); } if (effectTickBox.Checked) { EditorTools.WriteText(richTextBoxChat, toWrite, Color.Black, true); } }
private void UpdateScore(DialogueStateActionDTO reply) { HandleKeywords(reply.Meaning); HandleKeywords(reply.Style); }
private IEnumerator HandleSpeak(IAction speakAction) { Name currentState = speakAction.Parameters[0]; Name nextState = speakAction.Parameters[1]; Name meaning = speakAction.Parameters[2]; Name style = speakAction.Parameters[3]; var dialogs = m_iat.GetDialogueActions(currentState, nextState, meaning, style); var dialog = dialogs.Shuffle().FirstOrDefault(); if (dialog == null) { Debug.LogWarning("Unknown dialog action."); m_dialogController.AddDialogLine("... (unkown dialogue) ..."); } else { string subFolder = m_scenarioData.TTSFolder; if (subFolder != "<none>") { var path = string.Format("/TTS-Dialogs/{0}/{1}/{2}", subFolder, m_rpc.VoiceName, dialog.UtteranceId); var absolutePath = Application.streamingAssetsPath; #if UNITY_EDITOR || UNITY_STANDALONE absolutePath = "file://" + absolutePath; #endif string audioUrl = absolutePath + path + ".wav"; string xmlUrl = absolutePath + path + ".xml"; var audio = new WWW(audioUrl); var xml = new WWW(xmlUrl); yield return(audio); yield return(xml); var xmlError = !string.IsNullOrEmpty(xml.error); var audioError = !string.IsNullOrEmpty(audio.error); if (xmlError) { Debug.LogError(xml.error); } if (audioError) { Debug.LogError(audio.error); } m_dialogController.AddDialogLine(dialog.Utterance); if (xmlError || audioError) { yield return(new WaitForSeconds(2)); } else { var clip = audio.GetAudioClip(false); yield return(_body.PlaySpeech(clip, xml.text)); clip.UnloadAudioData(); } } else { m_dialogController.AddDialogLine(dialog.Utterance); yield return(new WaitForSeconds(2)); } reply = dialog; just_talked = true; } if (nextState.ToString() == "Disconnect") { this.End(); } AddEvent(EventHelper.ActionEnd(m_rpc.CharacterName.ToString(), speakAction.Name.ToString(), IATConsts.PLAYER).ToString()); }
/// <summary> /// Get CrewMember reply to player dialogue during a post-race event /// </summary> internal DialogueStateActionDTO SendPostRaceEvent(IntegratedAuthoringToolAsset iat, DialogueStateActionDTO selected, Team team, List <string> subjects) { if (selected == null) { return(null); } var nextState = selected.NextState; var dialogueOptions = iat.GetDialogueActionsByState(nextState).ToList(); //get dialogue if (dialogueOptions.Any()) { //select reply var selectedReply = dialogueOptions.OrderBy(o => Guid.NewGuid()).First(); PostRaceFeedback(selected.NextState, team, subjects); var styleSplit = selectedReply.Style.Split('_').Where(sp => !string.IsNullOrEmpty(sp)).ToList(); if (styleSplit.Any(s => s != WellFormedNames.Name.NIL_STRING)) { styleSplit.ForEach(s => PostRaceFeedback(s, team, subjects)); } return(selectedReply); } return(null); }
public IEnumerator HandleSpeak(IAction speakAction) { lastAction = speakAction; Name currentState = speakAction.Parameters[0]; Name nextState = speakAction.Parameters[1]; Name meaning = speakAction.Parameters[2]; Name style = speakAction.Parameters[3]; m_rpc.SaveToFile(m_rpc.CharacterName + "-output" + ".rpc"); var dialog = m_iat.GetDialogueActions(currentState, nextState, meaning, style).FirstOrDefault(); if (dialog == null) { Debug.LogWarning("Unknown dialog action."); m_dialogController.AddDialogLine("... (unkown dialogue) ..."); } else { string subFolder = m_scenarioData.TTSFolder; if (subFolder != "<none>") { var provider = (AssetManager.Instance.Bridge as AssetManagerBridge)._provider; var path = string.Format("/TTS-Dialogs/{0}/{1}/{2}", subFolder, m_rpc.VoiceName, dialog.UtteranceId); AudioClip clip = null; //Resources.Load<AudioClip>(path); string xml = null; //Resources.Load<TextAsset>(path); var xmlPath = path + ".xml"; if (provider.FileExists(xmlPath)) { try { using (var xmlStream = provider.LoadFile(xmlPath, FileMode.Open, FileAccess.Read)) { using (var reader = new StreamReader(xmlStream)) { xml = reader.ReadToEnd(); } } } catch (Exception e) { Debug.LogException(e); } if (!string.IsNullOrEmpty(xml)) { var wavPath = path + ".wav"; if (provider.FileExists(wavPath)) { try { using (var wavStream = provider.LoadFile(wavPath, FileMode.Open, FileAccess.Read)) { var wav = new WavStreamReader(wavStream); clip = AudioClip.Create("tmp", (int)wav.SamplesLength, wav.NumOfChannels, (int)wav.SampleRate, false); clip.SetData(wav.GetRawSamples(), 0); } } catch (Exception e) { Debug.LogException(e); if (clip != null) { clip.UnloadAudioData(); clip = null; } } } } } if (clip != null && xml != null) { yield return(_body.PlaySpeech(clip, xml)); clip.UnloadAudioData(); } else { Debug.LogWarning("Could not found speech assets for a dialog"); yield return(new WaitForSeconds(2)); } } else { yield return(nextframe); } if (nextState.ToString() != "-") //todo: replace with a constant { AddEvent(string.Format("Event(Property-change,Suspect,DialogueState(Player),{0})", nextState)); } } if (speakAction.Parameters[1].ToString() != "-") //todo: replace with a constant { var dialogueStateUpdateEvent = string.Format("Event(Property-Change, Suspect ,DialogueState({0}),{1})", speakAction.Target, speakAction.Parameters[1]); AddEvent(dialogueStateUpdateEvent); } if (nextState.ToString() == "Disconnect") { this.End(); } m_rpc.Perceive(new Name[] { EventHelper.ActionEnd(m_rpc.CharacterName.ToString(), speakAction.Name.ToString(), IATConsts.PLAYER) }); yield return(new WaitForSeconds(0.1f)); m_dialogController.AddDialogLine(dialog.Utterance); reply = dialog; just_talked = true; }
public IEnumerator HandleSpeak(IAction speakAction) { //m_rpc.Perceive(new [] { EventHelper.ActionStart(m_rpc.CharacterName.ToString(), speakAction.Name.ToString(), IATConsts.PLAYER) }); Name currentState = speakAction.Parameters[0]; Name nextState = speakAction.Parameters[1]; Name meaning = speakAction.Parameters[2]; Name style = speakAction.Parameters[3]; var Target = speakAction.Target; var dialogs = m_iat.GetDialogueActions(currentState, nextState, meaning, style); // Debug.Log("Here we go speaking: " + currentState.ToString() + " ns " + nextState.ToString() + " meaning " + meaning.ToString()); var dialog = dialogs.Shuffle().FirstOrDefault(); // Debug.Log("Going to say: " + dialog.Utterance); if (dialog == null) { Debug.LogWarning("Unknown dialog action."); m_dialogController.AddDialogLine("... (unkown dialogue) ..."); } else { this.setFloor(false); string subFolder = m_scenarioData.TTSFolder; if (subFolder != "<none>") { var path = string.Format("/TTS-Dialogs/{0}/{1}/{2}", subFolder, m_rpc.VoiceName, dialog.UtteranceId); var absolutePath = Application.streamingAssetsPath; #if UNITY_EDITOR || UNITY_STANDALONE absolutePath = "file://" + absolutePath; #endif string audioUrl = absolutePath + path + ".wav"; string xmlUrl = absolutePath + path + ".xml"; var audio = new WWW(audioUrl); var xml = new WWW(xmlUrl); yield return(audio); yield return(xml); var xmlError = !string.IsNullOrEmpty(xml.error); var audioError = !string.IsNullOrEmpty(audio.error); if (xmlError) { Debug.LogError(xml.error); } if (audioError) { Debug.LogError(audio.error); } m_dialogController.AddDialogLine(dialog.Utterance); if (xmlError || audioError) { yield return(new WaitForSeconds(2)); } else { var clip = audio.GetAudioClip(false); yield return(_body.PlaySpeech(clip, xml.text)); clip.UnloadAudioData(); } } else { m_dialogController.AddDialogLine(dialog.Utterance); yield return(new WaitForSeconds(2)); } if (RPC.GetBeliefValue("HasFloor(SELF)") != "True") //todo: replace with a constant { this.SetDialogueState(Target.ToString(), nextState.ToString()); reply = dialog; just_talked = true; } } if (nextState.ToString() == "Disconnect") { this.End(); } }