This component ties together the elements of the dialogue system: dialogue database, dialogue UI, sequencer, and conversation controller. More...
Public Member Functions | |
void | OnDestroy () |
void | Awake () |
Initializes the component by setting up the dialogue database and preparing the dialogue UI. More... | |
bool | StandardGetInputButtonDown (string buttonName) |
Standard Unity Input method to check if a button is down. More... | |
bool | IsDialogueSystemInputDisabled () |
Returns true if Dialogue System input is disabled. More... | |
void | SetDialogueSystemInput (bool value) |
Enables or disables Dialogue System input. More... | |
void | Start () |
Start by enforcing only one instance is specified. More... | |
void | SetLanguage (string language) |
Sets the language to use for localized text. More... | |
void | AddDatabase (DialogueDatabase database) |
Adds a dialogue database to memory. More... | |
void | RemoveDatabase (DialogueDatabase database) |
Removes a dialogue database from memory. More... | |
void | ResetDatabase (DatabaseResetOptions databaseResetOptions) |
Resets the database to a default state. More... | |
void | PreloadMasterDatabase () |
Preloads the master database. More... | |
void | PreloadDialogueUI () |
Preloads the dialogue UI. More... | |
bool | ConversationHasValidEntry (string title, Transform actor, Transform conversant) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false. More... | |
bool | ConversationHasValidEntry (string title, Transform actor) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false. More... | |
bool | ConversationHasValidEntry (string title) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false. More... | |
void | PreloadResources () |
Preloads the resources used by the Dialogue System to avoid delays caused by lazy loading. More... | |
void | StartConversation (string title, Transform actor, Transform conversant, int initialDialogueEntryID) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor and conversant. More... | |
void | StartConversation (string title, Transform actor, Transform conversant) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor and conversant. More... | |
void | StartConversation (string title, Transform actor) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor. More... | |
void | StartConversation (string title) |
Starts the conversation with no transforms specified for the actor or conversant. More... | |
void | StopConversation () |
Stops the current conversation immediately, and sends an OnConversationEnd message to the actor and conversant. More... | |
void | UpdateResponses () |
Updates the responses for the current state of the current conversation. More... | |
Transform | FindActorTransformFromConversation (string conversationTitle, string actorField) |
Given a conversation and an actor ID field name (Actor or Conversant), return a corresponding transform in the scene, or null if none found. More... | |
void | SetPortrait (string actorName, string portraitName) |
Sets an actor's portrait. More... | |
void | SetActorPortraitTexture (string actorName, Texture2D portraitTexture) |
This method is used internally by SetPortrait() to set the portrait texture for an actor. More... | |
void | OnEndConversation (ConversationController endingConversationController) |
Handles the end conversation event. More... | |
void | OnConversationTimeout () |
Handles the conversation response menu timeout event. More... | |
void | Bark (string conversationTitle, Transform speaker, Transform listener, BarkHistory barkHistory) |
Causes a character to bark a line at another character. More... | |
void | Bark (string conversationTitle, Transform speaker, Transform listener) |
Causes a character to bark a line at another character. More... | |
void | Bark (string conversationTitle, Transform speaker) |
Causes a character to bark a line. More... | |
void | Bark (string conversationTitle, Transform speaker, BarkHistory barkHistory) |
Causes a character to bark a line. More... | |
void | BarkString (string barkText, Transform speaker, Transform listener=null, string sequence=null) |
Causes a character to bark a literal string instead of looking up its line from a conversation. More... | |
float | GetBarkDuration (string barkText) |
Returns the default duration that a string of bark text will be shown. More... | |
void | ShowAlert (string message, float duration) |
Shows an alert message using the dialogue UI. More... | |
void | ShowAlert (string message) |
Shows an alert message using the dialogue UI for the UI's default duration. More... | |
void | CheckAlerts () |
Checks the value of Lua Variable['Alert']. More... | |
string | GetLocalizedText (string s) |
Gets localized text. More... | |
Sequencer | PlaySequence (string sequence, Transform speaker, Transform listener, bool informParticipants, bool destroyWhenDone, string entrytag) |
Starts a sequence. More... | |
Sequencer | PlaySequence (string sequence, Transform speaker, Transform listener, bool informParticipants, bool destroyWhenDone) |
Starts a sequence. More... | |
Sequencer | PlaySequence (string sequence, Transform speaker, Transform listener, bool informParticipants) |
Starts a sequence. More... | |
Sequencer | PlaySequence (string sequence, Transform speaker, Transform listener) |
Starts a sequence, and sends OnSequenceStart/OnSequenceEnd messages to the participants. More... | |
Sequencer | PlaySequence (string sequence) |
Starts a sequence. More... | |
void | StopSequence (Sequencer sequencer) |
Stops a sequence. More... | |
void | Pause () |
Pauses the Dialogue System. More... | |
void | Unpause () |
Unpauses the Dialogue System. More... | |
void | UseDialogueUI (GameObject gameObject) |
Sets the dialogue UI. More... | |
void | AddLuaObserver (string luaExpression, LuaWatchFrequency frequency, LuaChangedDelegate luaChangedHandler) |
Adds a Lua expression observer. More... | |
void | RemoveLuaObserver (string luaExpression, LuaWatchFrequency frequency, LuaChangedDelegate luaChangedHandler) |
Removes a Lua expression observer. More... | |
void | RemoveAllObservers (LuaWatchFrequency frequency) |
Removes all Lua expression observers for a specified frequency. More... | |
void | RemoveAllObservers () |
Removes all Lua expression observers. More... | |
void | RegisterAssetBundle (AssetBundle bundle) |
Registers an asset bundle with the Dialogue System. More... | |
void | UnregisterAssetBundle (AssetBundle bundle) |
Unregisters an asset bundle from the Dialogue System. More... | |
UnityEngine.Object | LoadAsset (string name) |
Loads a named asset from the registered asset bundles or from Resources. More... | |
UnityEngine.Object | LoadAsset (string name, System.Type type) |
Loads a named asset from the registered asset bundles or from Resources. More... | |
Static Public Member Functions | |
static void | LuaShowAlert (string message) |
Public Attributes | |
DialogueDatabase | initialDatabase = null |
The initial dialogue database. More... | |
DisplaySettings | displaySettings = new DisplaySettings() |
The display settings to use for the dialogue UI and sequencer. More... | |
PersistentDataSettings | persistentDataSettings = new PersistentDataSettings() |
Settings to apply to the PersistentDataManager. More... | |
bool | allowSimultaneousConversations = false |
Set true to allow more than one conversation to play simultaneously. More... | |
bool | includeSimStatus = false |
Set true to include sim status for each dialogue entry. More... | |
bool | preloadResources = false |
If true , preloads the master database and dialogue UI. More... | |
bool | instantiateDatabase = false |
bool | dontDestroyOnLoad = true |
If true , Unity will not destroy the game object when loading a new level. More... | |
bool | allowOnlyOneInstance = true |
If true , new DialogueSystemController objects will destroy themselves if one already exists in the scene. More... | |
DialogueTime.TimeMode | dialogueTimeMode = DialogueTime.TimeMode.Realtime |
Time mode to use for conversations. More... | |
DialogueDebug.DebugLevel | debugLevel = DialogueDebug.DebugLevel.Warning |
The debug level. More... | |
Static Public Attributes | |
static bool | applicationIsQuitting = false |
static string | lastInitialDatabaseName = null |
Properties | |
DatabaseManager | DatabaseManager [get] |
Gets the dialogue database manager. More... | |
DialogueDatabase | MasterDatabase [get] |
Gets the master dialogue database, which contains the initial database and any additional databases that you have added. More... | |
IDialogueUI | DialogueUI [get, set] |
Gets or sets the dialogue UI, which is an implementation of IDialogueUI. More... | |
IsDialogueEntryValidDelegate | IsDialogueEntryValid [get, set] |
The IsDialogueEntryValid delegate (if one is assigned). More... | |
GetInputButtonDownDelegate | GetInputButtonDown [get, set] |
The GetInputButtonDown delegate. More... | |
bool | IsConversationActive [get] |
Indicates whether a conversation is currently active. More... | |
Transform | CurrentActor [get] |
Gets the current actor of the last conversation started if a conversation is active. More... | |
Transform | CurrentConversant [get] |
Gets the current conversant of the last conversation started if a conversation is active. More... | |
ConversationState | CurrentConversationState [get, set] |
Gets or sets the current conversation state of the last conversation that had a line. More... | |
string | LastConversationStarted [get] |
Gets the title of the last conversation started. More... | |
int | LastConversationID [get] |
Gets the ID of the last conversation started. More... | |
ConversationController | ConversationController [get] |
ConversationModel? | ConversationModel [get] |
ConversationView? | ConversationView [get] |
List< ActiveConversationRecord > | ActiveConversations [get] |
bool | AllowLuaExceptions [get, set] |
Indicates whether to allow the Lua environment to pass exceptions up to the caller. More... | |
bool | WarnIfActorAndConversantSame [get, set] |
If true , warns if a conversation starts with the actor and conversant pointing to the same transform. More... | |
This component ties together the elements of the dialogue system: dialogue database, dialogue UI, sequencer, and conversation controller.
You will typically add this to a "manager" type game object in your scene. For simplified script access, you can use the DialogueManager static class.
void PixelCrushers.DialogueSystem.DialogueSystemController.AddDatabase | ( | DialogueDatabase | database | ) |
Adds a dialogue database to memory.
To save memory or reduce load time, you may want to break up your dialogue data into multiple smaller databases. You can add or remove these databases as needed.
database | The database to add. |
void PixelCrushers.DialogueSystem.DialogueSystemController.AddLuaObserver | ( | string | luaExpression, |
LuaWatchFrequency | frequency, | ||
LuaChangedDelegate | luaChangedHandler | ||
) |
void PixelCrushers.DialogueSystem.DialogueSystemController.Awake | ( | ) |
Initializes the component by setting up the dialogue database and preparing the dialogue UI.
If the assigned UI is a prefab, an instance is added. If no UI is assigned, the default UI is loaded.
void PixelCrushers.DialogueSystem.DialogueSystemController.Bark | ( | string | conversationTitle, |
Transform | speaker | ||
) |
Causes a character to bark a line.
A bark is a line spoken outside of a full conversation. It uses a simple gameplay bark UI instead of the dialogue UI. Since this form of the Bark() method does not include a BarkHistory, a random bark is selected from the bark lines.
conversationTitle | Title of the conversation that contains the bark lines. In this conversation, all dialogue entries linked from the first entry are considered bark lines. |
speaker | The character barking the line. |
void PixelCrushers.DialogueSystem.DialogueSystemController.Bark | ( | string | conversationTitle, |
Transform | speaker, | ||
BarkHistory | barkHistory | ||
) |
Causes a character to bark a line.
A bark is a line spoken outside of a full conversation. It uses a simple gameplay bark UI instead of the dialogue UI.
conversationTitle | Title of the conversation that contains the bark lines. In this conversation, all dialogue entries linked from the first entry are considered bark lines. |
speaker | The character barking the line. |
barkHistory | Bark history used to track the most recent bark, so the bark controller can go through the bark lines in a specified order. |
void PixelCrushers.DialogueSystem.DialogueSystemController.Bark | ( | string | conversationTitle, |
Transform | speaker, | ||
Transform | listener | ||
) |
Causes a character to bark a line at another character.
A bark is a line spoken outside of a full conversation. It uses a simple gameplay bark UI instead of the dialogue UI. Since this form of the Bark() method does not include a BarkHistory, a random bark is selected from the bark lines.
conversationTitle | Title of the conversation that contains the bark lines. In this conversation, all dialogue entries linked from the first entry are considered bark lines. |
speaker | The character barking the line. |
listener | The character being barked at. |
void PixelCrushers.DialogueSystem.DialogueSystemController.Bark | ( | string | conversationTitle, |
Transform | speaker, | ||
Transform | listener, | ||
BarkHistory | barkHistory | ||
) |
Causes a character to bark a line at another character.
A bark is a line spoken outside of a full conversation. It uses a simple gameplay bark UI instead of the dialogue UI.
conversationTitle | Title of the conversation that contains the bark lines. In this conversation, all dialogue entries linked from the first entry are considered bark lines. |
speaker | The character barking the line. |
listener | The character being barked at. |
barkHistory | Bark history used to track the most recent bark, so the bark controller can go through the bark lines in a specified order. |
void PixelCrushers.DialogueSystem.DialogueSystemController.BarkString | ( | string | barkText, |
Transform | speaker, | ||
Transform | listener = null , |
||
string | sequence = null |
||
) |
Causes a character to bark a literal string instead of looking up its line from a conversation.
barkText | The string to bark. |
speaker | The barker. |
listener | The target of the bark. (May be null) |
sequence | The optional sequence to play. (May be null or empty) |
void PixelCrushers.DialogueSystem.DialogueSystemController.CheckAlerts | ( | ) |
bool PixelCrushers.DialogueSystem.DialogueSystemController.ConversationHasValidEntry | ( | string | title | ) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false.
true
, if the conversation has a valid entry, false
otherwise. title | The title of the conversation to look up in the master database. |
bool PixelCrushers.DialogueSystem.DialogueSystemController.ConversationHasValidEntry | ( | string | title, |
Transform | actor | ||
) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false.
true
, if the conversation has a valid entry, false
otherwise. title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
bool PixelCrushers.DialogueSystem.DialogueSystemController.ConversationHasValidEntry | ( | string | title, |
Transform | actor, | ||
Transform | conversant | ||
) |
Checks whether a conversation has any valid entries linked from the start entry, since it's possible that the conditions of all entries could be false.
true
, if the conversation has a valid entry, false
otherwise. title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
conversant | The transform of the conversant (the other participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the conversant is usually the NPC. |
Transform PixelCrushers.DialogueSystem.DialogueSystemController.FindActorTransformFromConversation | ( | string | conversationTitle, |
string | actorField | ||
) |
Given a conversation and an actor ID field name (Actor or Conversant), return a corresponding transform in the scene, or null if none found.
conversationTitle | Conversation title. |
actorField | Actor or Conversant. |
float PixelCrushers.DialogueSystem.DialogueSystemController.GetBarkDuration | ( | string | barkText | ) |
Returns the default duration that a string of bark text will be shown.
barkText | The text that will be barked (to determine the duration). |
string PixelCrushers.DialogueSystem.DialogueSystemController.GetLocalizedText | ( | string | s | ) |
Gets localized text.
s | The field to look up. |
bool PixelCrushers.DialogueSystem.DialogueSystemController.IsDialogueSystemInputDisabled | ( | ) |
Returns true if Dialogue System input is disabled.
UnityEngine.Object PixelCrushers.DialogueSystem.DialogueSystemController.LoadAsset | ( | string | name | ) |
Loads a named asset from the registered asset bundles or from Resources.
null
if not found.name | Name of the asset. |
UnityEngine.Object PixelCrushers.DialogueSystem.DialogueSystemController.LoadAsset | ( | string | name, |
System.Type | type | ||
) |
Loads a named asset from the registered asset bundles or from Resources.
null
if not found.name | Name of the asset. |
type | Type of the asset. |
|
static |
void PixelCrushers.DialogueSystem.DialogueSystemController.OnConversationTimeout | ( | ) |
Handles the conversation response menu timeout event.
void PixelCrushers.DialogueSystem.DialogueSystemController.OnDestroy | ( | ) |
void PixelCrushers.DialogueSystem.DialogueSystemController.OnEndConversation | ( | ConversationController | endingConversationController | ) |
Handles the end conversation event.
void PixelCrushers.DialogueSystem.DialogueSystemController.Pause | ( | ) |
Pauses the Dialogue System.
Also broadcasts OnDialogueSystemPause to the Dialogue Manager and conversation participants. Conversations, timers, typewriter and fade effects, and the AudioWait() and Voice() sequencer commands will be paused. Other than this, AudioSource, Animation, and Animator components will not be paused; it's up to you to handle them as appropriate for your project.
Sequencer PixelCrushers.DialogueSystem.DialogueSystemController.PlaySequence | ( | string | sequence | ) |
Starts a sequence.
See sequencer.
sequence | The sequence to play. |
Sequencer PixelCrushers.DialogueSystem.DialogueSystemController.PlaySequence | ( | string | sequence, |
Transform | speaker, | ||
Transform | listener | ||
) |
Starts a sequence, and sends OnSequenceStart/OnSequenceEnd messages to the participants.
See sequencer.
sequence | The sequence to play. |
speaker | The speaker, for sequence commands that reference the speaker. |
listener | The listener, for sequence commands that reference the listener. |
Sequencer PixelCrushers.DialogueSystem.DialogueSystemController.PlaySequence | ( | string | sequence, |
Transform | speaker, | ||
Transform | listener, | ||
bool | informParticipants | ||
) |
Starts a sequence.
See sequencer.
sequence | The sequence to play. |
speaker | The speaker, for sequence commands that reference the speaker. |
listener | The listener, for sequence commands that reference the listener. |
informParticipants | Specifies whether to send OnSequenceStart and OnSequenceEnd messages to the speaker and listener. Default is true . |
Sequencer PixelCrushers.DialogueSystem.DialogueSystemController.PlaySequence | ( | string | sequence, |
Transform | speaker, | ||
Transform | listener, | ||
bool | informParticipants, | ||
bool | destroyWhenDone | ||
) |
Starts a sequence.
See sequencer.
sequence | The sequence to play. |
speaker | The speaker, for sequence commands that reference the speaker. |
listener | The listener, for sequence commands that reference the listener. |
informParticipants | Specifies whether to send OnSequenceStart and OnSequenceEnd messages to the speaker and listener. Default is true . |
destroyWhenDone | Specifies whether destroy the sequencer when done playing the sequence. Default is true . |
Sequencer PixelCrushers.DialogueSystem.DialogueSystemController.PlaySequence | ( | string | sequence, |
Transform | speaker, | ||
Transform | listener, | ||
bool | informParticipants, | ||
bool | destroyWhenDone, | ||
string | entrytag | ||
) |
Starts a sequence.
See sequencer.
sequence | The sequence to play. |
speaker | The speaker, for sequence commands that reference the speaker. |
listener | The listener, for sequence commands that reference the listener. |
informParticipants | Specifies whether to send OnSequenceStart and OnSequenceEnd messages to the speaker and listener. Default is true . |
destroyWhenDone | Specifies whether destroy the sequencer when done playing the sequence. Default is |
entrytag | The entrytag to associate with the sequence. |
void PixelCrushers.DialogueSystem.DialogueSystemController.PreloadDialogueUI | ( | ) |
Preloads the dialogue UI.
The Dialogue System delays loading of the dialogue UI until the first time it's needed for a conversation or alert. Since dialogue UIs often contain textures and other art assets, loading can cause a slight pause. You may want to preload the UI at a time of your design by using this method.
void PixelCrushers.DialogueSystem.DialogueSystemController.PreloadMasterDatabase | ( | ) |
void PixelCrushers.DialogueSystem.DialogueSystemController.PreloadResources | ( | ) |
Preloads the resources used by the Dialogue System to avoid delays caused by lazy loading.
void PixelCrushers.DialogueSystem.DialogueSystemController.RegisterAssetBundle | ( | AssetBundle | bundle | ) |
Registers an asset bundle with the Dialogue System.
This allows sequencer commands to load assets inside it.
bundle | Asset bundle. |
void PixelCrushers.DialogueSystem.DialogueSystemController.RemoveAllObservers | ( | ) |
Removes all Lua expression observers.
void PixelCrushers.DialogueSystem.DialogueSystemController.RemoveAllObservers | ( | LuaWatchFrequency | frequency | ) |
Removes all Lua expression observers for a specified frequency.
frequency | Frequency. |
void PixelCrushers.DialogueSystem.DialogueSystemController.RemoveDatabase | ( | DialogueDatabase | database | ) |
Removes a dialogue database from memory.
To save memory or reduce load time, you may want to break up your dialogue data into multiple smaller databases. You can add or remove these databases as needed.
database | The database to remove. |
void PixelCrushers.DialogueSystem.DialogueSystemController.RemoveLuaObserver | ( | string | luaExpression, |
LuaWatchFrequency | frequency, | ||
LuaChangedDelegate | luaChangedHandler | ||
) |
void PixelCrushers.DialogueSystem.DialogueSystemController.ResetDatabase | ( | DatabaseResetOptions | databaseResetOptions | ) |
Resets the database to a default state.
databaseResetOptions | Accepts the following values:
|
void PixelCrushers.DialogueSystem.DialogueSystemController.SetActorPortraitTexture | ( | string | actorName, |
Texture2D | portraitTexture | ||
) |
This method is used internally by SetPortrait() to set the portrait texture for an actor.
actorName | Actor name. |
portraitTexture | Portrait texture. |
void PixelCrushers.DialogueSystem.DialogueSystemController.SetDialogueSystemInput | ( | bool | value | ) |
Enables or disables Dialogue System input.
value | True to enable, false to disable. |
void PixelCrushers.DialogueSystem.DialogueSystemController.SetLanguage | ( | string | language | ) |
Sets the language to use for localized text.
language | Language to use. Specify null or an emtpy string to use the default language. |
void PixelCrushers.DialogueSystem.DialogueSystemController.SetPortrait | ( | string | actorName, |
string | portraitName | ||
) |
Sets an actor's portrait.
If can be:
null
to use the primary portrait defined in the database,actorName | Actor name. |
portraitName | Portrait name. |
void PixelCrushers.DialogueSystem.DialogueSystemController.ShowAlert | ( | string | message | ) |
Shows an alert message using the dialogue UI for the UI's default duration.
message | The message to show. |
void PixelCrushers.DialogueSystem.DialogueSystemController.ShowAlert | ( | string | message, |
float | duration | ||
) |
Shows an alert message using the dialogue UI.
message | The message to show. |
duration | The duration in seconds to show the message. |
bool PixelCrushers.DialogueSystem.DialogueSystemController.StandardGetInputButtonDown | ( | string | buttonName | ) |
Standard Unity Input method to check if a button is down.
buttonName |
void PixelCrushers.DialogueSystem.DialogueSystemController.Start | ( | ) |
Start by enforcing only one instance is specified.
Then start monitoring alerts.
void PixelCrushers.DialogueSystem.DialogueSystemController.StartConversation | ( | string | title | ) |
Starts the conversation with no transforms specified for the actor or conversant.
title | The title of the conversation to look up in the master database. |
void PixelCrushers.DialogueSystem.DialogueSystemController.StartConversation | ( | string | title, |
Transform | actor | ||
) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor.
Your scripts can listen for OnConversationStart to do anything necessary at the beginning of a conversation, such as pausing other gameplay or temporarily disabling player control. See the Feature Demo scene, which uses the SetEnabledOnDialogueEvent component to disable player control during conversations.
title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
void PixelCrushers.DialogueSystem.DialogueSystemController.StartConversation | ( | string | title, |
Transform | actor, | ||
Transform | conversant | ||
) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor and conversant.
Your scripts can listen for OnConversationStart to do anything necessary at the beginning of a conversation, such as pausing other gameplay or temporarily disabling player control. See the Feature Demo scene, which uses the SetEnabledOnDialogueEvent component to disable player control during conversations.
title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
conversant | The transform of the conversant (the other participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the conversant is usually the NPC. |
Example:
void PixelCrushers.DialogueSystem.DialogueSystemController.StartConversation | ( | string | title, |
Transform | actor, | ||
Transform | conversant, | ||
int | initialDialogueEntryID | ||
) |
Starts a conversation, which also broadcasts an OnConversationStart message to the actor and conversant.
Your scripts can listen for OnConversationStart to do anything necessary at the beginning of a conversation, such as pausing other gameplay or temporarily disabling player control. See the Feature Demo scene, which uses the SetEnabledOnDialogueEvent component to disable player control during conversations.
title | The title of the conversation to look up in the master database. |
actor | The transform of the actor (primary participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the actor is usually the PC. |
conversant | The transform of the conversant (the other participant). The sequencer uses this to direct camera angles and perform other actions. In PC-NPC conversations, the conversant is usually the NPC. |
initialDialogueEntryID | The initial dialogue entry ID, or -1 to start from the beginning. |
Example:
void PixelCrushers.DialogueSystem.DialogueSystemController.StopConversation | ( | ) |
Stops the current conversation immediately, and sends an OnConversationEnd message to the actor and conversant.
Your scripts can listen for OnConversationEnd to do anything necessary at the end of a conversation, such as resuming other gameplay or re-enabling player control.
void PixelCrushers.DialogueSystem.DialogueSystemController.StopSequence | ( | Sequencer | sequencer | ) |
Stops a sequence.
sequencer | The sequencer playing the sequence. |
void PixelCrushers.DialogueSystem.DialogueSystemController.Unpause | ( | ) |
Unpauses the Dialogue System.
Also broadcasts OnDialogueSystemUnpause to the Dialogue Manager and conversation participants.
void PixelCrushers.DialogueSystem.DialogueSystemController.UnregisterAssetBundle | ( | AssetBundle | bundle | ) |
Unregisters an asset bundle from the Dialogue System.
Always unregister asset bundles before freeing them.
bundle | Asset bundle. |
void PixelCrushers.DialogueSystem.DialogueSystemController.UpdateResponses | ( | ) |
Updates the responses for the current state of the current conversation.
If the response menu entries' conditions have changed while the response menu is being shown, you can call this method to update the response menu.
void PixelCrushers.DialogueSystem.DialogueSystemController.UseDialogueUI | ( | GameObject | gameObject | ) |
Sets the dialogue UI.
(Deprecated; just set DialogueUI now.)
gameObject | Game object containing an implementation of IDialogueUI. |
bool PixelCrushers.DialogueSystem.DialogueSystemController.allowOnlyOneInstance = true |
If true
, new DialogueSystemController objects will destroy themselves if one already exists in the scene.
Otherwise, if you reload a level and dontDestroyOnLoad is true, you'll end up with a second object.
bool PixelCrushers.DialogueSystem.DialogueSystemController.allowSimultaneousConversations = false |
Set true
to allow more than one conversation to play simultaneously.
|
static |
DialogueDebug.DebugLevel PixelCrushers.DialogueSystem.DialogueSystemController.debugLevel = DialogueDebug.DebugLevel.Warning |
The debug level.
Information at this level or higher is logged to the console. This can be helpful when tracing through conversations.
DialogueTime.TimeMode PixelCrushers.DialogueSystem.DialogueSystemController.dialogueTimeMode = DialogueTime.TimeMode.Realtime |
Time mode to use for conversations.
DisplaySettings PixelCrushers.DialogueSystem.DialogueSystemController.displaySettings = new DisplaySettings() |
The display settings to use for the dialogue UI and sequencer.
bool PixelCrushers.DialogueSystem.DialogueSystemController.dontDestroyOnLoad = true |
If true
, Unity will not destroy the game object when loading a new level.
bool PixelCrushers.DialogueSystem.DialogueSystemController.includeSimStatus = false |
Set true
to include sim status for each dialogue entry.
DialogueDatabase PixelCrushers.DialogueSystem.DialogueSystemController.initialDatabase = null |
The initial dialogue database.
bool PixelCrushers.DialogueSystem.DialogueSystemController.instantiateDatabase = false |
|
static |
PersistentDataSettings PixelCrushers.DialogueSystem.DialogueSystemController.persistentDataSettings = new PersistentDataSettings() |
Settings to apply to the PersistentDataManager.
bool PixelCrushers.DialogueSystem.DialogueSystemController.preloadResources = false |
If true
, preloads the master database and dialogue UI.
Otherwise they're lazy- loaded only before the first time they're needed.
|
get |
|
getset |
|
get |
|
get |
|
get |
|
get |
Gets the current actor of the last conversation started if a conversation is active.
The current actor.
|
get |
Gets the current conversant of the last conversation started if a conversation is active.
The current conversant.
|
getset |
Gets or sets the current conversation state of the last conversation that had a line.
This is set by ConversationController as the conversation moves from state to state.
The current conversation state.
|
get |
Gets the dialogue database manager.
The database manager.
|
getset |
Gets or sets the dialogue UI, which is an implementation of IDialogueUI.
The dialogue UI.
|
getset |
The GetInputButtonDown delegate.
Overrides calls to the standard Unity Input.GetButtonDown function.
|
get |
Indicates whether a conversation is currently active.
true
if the conversation is active; otherwise, false
.
|
getset |
The IsDialogueEntryValid delegate (if one is assigned).
This is an optional delegate that you can add to check if a dialogue entry is valid before allowing a conversation to use it.
|
get |
Gets the ID of the last conversation started.
|
get |
Gets the title of the last conversation started.
If a conversation is active, this is the title of the active conversation.
The title of the last conversation started.
|
get |
Gets the master dialogue database, which contains the initial database and any additional databases that you have added.
The master database.
|
getset |
If true
, warns if a conversation starts with the actor and conversant pointing to the same transform.
Default is false
.
true
to warn when actor and conversant are the same; otherwise, false
.