private void BarkNextCachedLine(Transform speaker, Transform listener) { if ((barkUI != null) && (cachedState != null) && cachedState.hasAnyResponses) { Response[] responses = cachedState.hasNPCResponse ? cachedState.npcResponses : cachedState.pcResponses; int index = (barkHistory ?? new BarkHistory(BarkOrder.Random)).GetNextIndex(responses.Length); DialogueEntry barkEntry = responses[index].destinationEntry; if ((barkEntry == null) && DialogueDebug.logWarnings) { Debug.Log(string.Format("{0}: Bark (speaker={1}, listener={2}): '{3}' bark entry is null", new System.Object[] { DialogueDebug.Prefix, speaker, listener, conversation }), speaker); } if (barkEntry != null) { Subtitle subtitle = new Subtitle(cachedState.subtitle.listenerInfo, cachedState.subtitle.speakerInfo, cachedState.subtitle.entryActorsInfo, new FormattedText(barkEntry.currentDialogueText), string.Empty, string.Empty, barkEntry); if (DialogueDebug.logInfo) { Debug.Log(string.Format("{0}: Bark (speaker={1}, listener={2}): '{3}'", new System.Object[] { DialogueDebug.Prefix, speaker, listener, subtitle.formattedText.text }), speaker); } if (barkGroupMember != null) { barkGroupMember.GroupBarkString(subtitle.formattedText.text, listener, subtitle.sequence); } else { StartCoroutine(BarkController.Bark(subtitle, speaker, listener, barkUI)); } } } }
protected virtual void DoBarkAction(Transform actor) { switch (barkSource) { case BarkSource.Conversation: if (string.IsNullOrEmpty(barkConversation)) { return; } if (DialogueManager.isConversationActive && !allowBarksDuringConversations) { if (DialogueDebug.logWarnings) { Debug.LogWarning("Dialogue System: Bark triggered on " + name + ", but a conversation is already active.", GetBarker(barkConversation)); } } else if (cacheBarkLines) { BarkCachedLine(GetBarker(barkConversation), Tools.Select(barkTarget, actor)); } else { if (barkGroupMember != null) { barkGroupMember.GroupBark(barkConversation, Tools.Select(barkTarget, actor), barkHistory); } else { DialogueManager.Bark(barkConversation, GetBarker(barkConversation), Tools.Select(barkTarget, actor), barkHistory); } sequencer = BarkController.LastSequencer; } break; case BarkSource.Text: if (string.IsNullOrEmpty(barkText)) { return; } if (DialogueManager.isConversationActive && !allowBarksDuringConversations) { if (DialogueDebug.logWarnings) { Debug.LogWarning("Dialogue System: Bark triggered on " + name + ", but a conversation is already active.", GetBarker(null)); } } else { if (barkGroupMember != null) { barkGroupMember.GroupBarkString(barkText, Tools.Select(barkTarget, actor), barkTextSequence); } else { DialogueManager.BarkString(barkText, GetBarker(null), Tools.Select(barkTarget, actor), barkTextSequence); } sequencer = BarkController.LastSequencer; } break; } }