//Starts specific conversation private void StartConversation(string conversationReference, BaseCharacterController listener) { _currentFragment = App.AIBlackboard.GetConversation(conversationReference); _talkingTo = listener; _conversation = StartCoroutine(RunConversation(conversationReference)); }
public bool IsPlayerConversation(ConversationFragment conversation) { if (conversation.IsPlayer) { return(true); } if (conversation.NextFragments.Length == 0) { return(false); } bool isPlayerConversation = false; foreach (ConversationFragment fragment in conversation.NextFragments) { isPlayerConversation |= IsPlayerConversation(fragment); if (isPlayerConversation) { break; } } return(isPlayerConversation); }
public ConversationFragment GetOrLoadConversation(TextAsset conversationAsset) { ConversationFragment conversation = GetConversation(conversationAsset.name); if (conversation == null) { ConversationNode node = NodeUtils.LoadGraph(conversationAsset.bytes, NodeUtils.CreateNode <ConversationNode>) as ConversationNode; Conversations.Add(new DataMap() { ConversationStart = node.Sentence, Asset = conversationAsset }); conversation = GetConversation(conversationAsset.name); } return(conversation); }
private void OnDialogueClosed() { _dialogueClosed = true; ConversationFunctionLibrary.RunFunction(_currentFragment.Output, _currentFragment.OptionOutputData[_optionSelected], _owner, _talkingTo); if (_currentFragment.NextFragments.Length > 0) { _currentFragment = _currentFragment.NextFragments[_optionSelected]; } else { _currentFragment = null; } _currentDialogue = null; _currentBubble = null; }
//Sets up stack of conversations private void SetupConversations(TextAsset[] conversationReferences) { foreach (TextAsset reference in conversationReferences) { if (reference == null) { Debug.LogError(string.Format("Conversation reference was null on {0}", gameObject.name), gameObject); continue; } ConversationFragment conversation = App.AIBlackboard.GetOrLoadConversation(reference); if (conversation != null) { _availableConversations.Add(reference.name); } else { Debug.LogError("Couldn't find conversation with reference " + reference); } } }