1. Read dialogue entries directly from the dialogue database:
Code: Select all
Conversation conversation = DialogueManager.masterDatabase.GetConversation("My Conversation");
foreach (DialogueEntry entry in conversation.dialogueEntries)
{
Debug.Log(entry.DialogueText);
}
2. Or start a ConversationModel. When the Dialogue System runs a conversation, it uses a Model-View-Controller (MVC) architecture. The model holds the data, including the current state of the conversation. The view manages the UI. The controller is the intermediary between the model and view.
Code: Select all
ConversationModel model = new ConversationModel(DialogueManager.masterDatabase, conversation, null, null, false, null);
ConversationState state = model.firstState;
do
{
Debug.Log(state.subtitle.dialogueEntry.id + ": " + state.subtitle.formattedText.text);
if (state.hasNPCResponse)
{
state = model.GetState(state.firstNPCResponse.destinationEntry, true);
}
else if (state.HasPCResponses)
{
state = model.GetState(state.pcResponses[0].destinationEntry, true);
}
else
{
state = null;
}
} while (state != null);
3. Or run a full fledged conversation, but provide your own UI implementation. In #2, I mentioned that conversations use an MVC architecture. The view consists of two parts: a dialogue UI (subtitles, response menus, etc.) and a cutscene sequencer. The view will work happily with any dialogue UI script that implements the IDialogueUI C# interface. The Templates folder has a starter script for custom implementations of IDialogueUI. Simply assign your dialogue UI GameObject to the Dialogue Manager's Dialogue UI field. Devs have created IDialogueUI implementations for all kinds of interfaces, such as virtual room installations, audio-only smart speakers, etc.
#3 allows the Dialogue System to run its complete MVC architecture.