private IEnumerator RunConversation(string conversationReference) { SetPromptVisible(false); IsInConversation = true; ConversationStarted.InvokeSafe(_currentFragment, _owner); while (_currentFragment != null) { if (_currentFragment.IsPlayer) { yield return(ShowPlayerSpeech(_currentFragment.ToSay[0], _currentFragment.ToSay[1])); } else { yield return(ShowSpeech(_currentFragment.ToSay[0], false)); } } _talkingTo = null; IsInConversation = false; if (ConversationFunctionLibrary.ShouldRerun(App.AIBlackboard.GetConversation(conversationReference).ShouldRerun, _owner)) { _availableConversations.Insert(0, conversationReference); } ConversationEnded.InvokeSafe(_owner); if (_conversationTrigger.bounds.Contains(App.AIBlackboard.Player.transform.position)) { SetPromptVisible(true); } _conversation = null; }
private int IsConversationAvailable() { if (_availableConversations.Count > 0 && WantsToTalk()) { for (int idx = 0; idx < _availableConversations.Count; idx++) { if (ConversationFunctionLibrary.IsAvailable(App.AIBlackboard.GetConversation(_availableConversations[idx]).IsAvailable, _owner)) { return(idx); } } } return(-1); }
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; }