If you want notification on another participant at, for example, the end of the conversation, you can use OnConversationEnd on the Dialogue Manager GameObject. It always receives all OnConversationStart/End messages. Or hook into the C# event DialogueManager.instance.conversationEnded. Example: (works best if characters' GameObjects have DialogueActor components)
Code: Select all
void OnConversationEnd(Transform actor) // Put this in a script on Dialogue Manager.
{
var conversation = DialogueManager.masterDatabase.GetConversation(DialogueManager.lastConversationID);
var primaryActorIDs = new HashSet<int>() { conversation.ActorID, conversation.ConversantID };
// Identify all non-primary participants:
var otherActorIDs = new HashSet<int>();
foreach (var entry in conversation.dialogueEntries)
{
var actorID = entry.ActorID;
if (!primaryActorIDs.Contains(actorID)) otherActorIDs.Add(actorID);
}
// Send OnConversationEnd messages to them:
foreach (var actorID in otherActorIDs)
{
var actor = DialogueManager.masterDatabase.GetActor(actorID);
var actorTransform = CharacterInfo.GetRegisteredActorTransform(actor.Name);
if (actorTransform != null)
{
actorTransform.BroadcastMessage(DialogueSystemMessages.OnConversationEnd, DialogueManager.currentActor, SendMessageOptions.DontRequireReceiver);
}
}
}