/// <summary> /// Quits the dialogues (close the UI) /// </summary> public void QuitDialogue() { currentDialogue = null; TriggerExitAction(); currentConversant = null; currentNode = null; OnConversationUpdated(); }
public DialogueNodeData GetRootNode() { var entryPoint = NodeLinks.Find(x => x.PortName == "START"); DialogueNodeData wantedNode = dialogueNodeData.Find(x => x.GUID == entryPoint.TargetNodeGuid); return(wantedNode); }
/// <summary> /// Starts a Dialogue based on an AIConversant data /// </summary> /// <param name="_currentConversant"></param> /// <param name="_currentDialogue"></param> public void StartDialogue(AIConversant _currentConversant, DialogueContainer _currentDialogue) { if (_currentDialogue != null && _currentConversant != null) { currentDialogue = _currentDialogue; currentConversant = _currentConversant; currentNode = currentDialogue.GetRootNode(); if (OnConversationUpdated != null) { OnConversationUpdated(); } TriggerEnterAction(); } }
/// <summary> /// Starts a Dialogue based on an AIConversant data /// </summary> /// <param name="_currentConversant"></param> /// <param name="_currentDialogue"></param> public void StartDialogue(AIConversant _currentConversant, DialogueContainer _currentDialogue) { if (_currentDialogue != null && _currentConversant != null) { currentDialogue = _currentDialogue; currentConversant = _currentConversant; currentNode = currentDialogue.GetRootNode(); //We need to update the exposed properties linked to buttons here HandleButtonsExposedProperties(); if (OnConversationUpdated != null) { OnConversationUpdated(); } TriggerEnterAction(); } }
/// <summary> /// Goes to the next node base on a choice /// </summary> /// <param name="choice"></param> public void Next(string choice) { List <string> choicesWithoutExposed = GetChoices(false); List <string> choices = new List <string>(); for (int i = 0; i < choicesWithoutExposed.Count; i++) { choices.Add(ReplaceWithExposedPropety(choicesWithoutExposed[i])); } for (int i = 0; i <= choices.Count; i++) { if (choices[i] == choice) { TriggerExitAction(); currentNode = currentDialogue.GetNextNode(currentNode.GUID, choicesWithoutExposed[i]); TriggerEnterAction(); OnConversationUpdated(); return; } } //In case we reach here OnConversationUpdated(); }