Class DialogManager
- Namespace
- WitShells.DialogsManager
Manages dialog playback and conversation flow. Singleton pattern ensures only one DialogManager exists in the scene.
public class DialogManager : MonoSingleton<DialogManager>
- Inheritance
-
DialogManager
- Inherited Members
- Extension Methods
Fields
playableDirector
public PlayableDirector playableDirector
Field Value
- PlayableDirector
Properties
AudioSource
The audio source used for dialog audio playback.
public AudioSource AudioSource { get; }
Property Value
- AudioSource
CurrentConversation
The currently active conversation.
public Conversation CurrentConversation { get; }
Property Value
CurrentDialog
The currently playing dialog.
public DialogObject CurrentDialog { get; }
Property Value
HasActiveConversation
Whether a conversation is active.
public bool HasActiveConversation { get; }
Property Value
IsPlaying
Whether a dialog is currently playing.
public bool IsPlaying { get; }
Property Value
OnConversationEnded
Unity event accessor for conversation ended.
public ConversationEvent OnConversationEnded { get; }
Property Value
OnConversationStarted
Unity event accessor for conversation started.
public ConversationEvent OnConversationStarted { get; }
Property Value
OnDialogFinished
Unity event accessor for dialog finished.
public DialogEvent OnDialogFinished { get; }
Property Value
OnDialogStarted
Unity event accessor for dialog started.
public DialogEvent OnDialogStarted { get; }
Property Value
Methods
EndConversation(bool)
Ends the current conversation.
public void EndConversation(bool wasCompleted = true)
Parameters
wasCompletedboolWhether the conversation was completed naturally.
GetConversationProgress()
Gets the progress of the current conversation (0-1).
public float GetConversationProgress()
Returns
GetDialogAudioProgress()
Gets the current dialog's audio playback progress (0-1).
public float GetDialogAudioProgress()
Returns
GetRemainingDialogsCount()
Gets the remaining dialogs count in the current conversation.
public int GetRemainingDialogsCount()
Returns
HandleActionAndRewind(float, IDialogActionRequire, double)
public void HandleActionAndRewind(float delay, IDialogActionRequire dialogActionRequire, double audioLength)
Parameters
delayfloatdialogActionRequireIDialogActionRequireaudioLengthdouble
HasMoreDialogs()
Checks if the current conversation has more dialogs.
public bool HasMoreDialogs()
Returns
JumpToConversation(Conversation, int)
Skips to a specific conversation and optionally starts from a specific dialog index.
public void JumpToConversation(Conversation conversation, int startDialogIndex = 0)
Parameters
conversationConversationstartDialogIndexint
OnDestroy()
Unity lifecycle: clears the static instance reference when this object is destroyed.
protected override void OnDestroy()
PauseDialog()
Pauses the current dialog audio.
public void PauseDialog()
PlayDialog(DialogObject)
Plays a specific dialog.
public void PlayDialog(DialogObject dialog)
Parameters
dialogDialogObjectThe dialog to play.
PlayNextDialog()
Plays the next dialog in the current conversation.
public bool PlayNextDialog()
Returns
- bool
True if a dialog was played, false if no more dialogs.
ResumeDialog()
Resumes the paused dialog audio.
public void ResumeDialog()
SetAudioSource(AudioSource)
Sets the audio source to use for dialog playback.
public void SetAudioSource(AudioSource source)
Parameters
sourceAudioSource
SkipCurrentDialog(bool)
Skips the current dialog and optionally plays the next one.
public void SkipCurrentDialog(bool playNext = true)
Parameters
playNextboolWhether to automatically play the next dialog.
StartConversation(Conversation, bool)
Starts a new conversation.
public void StartConversation(Conversation conversation, bool resetConversation = true)
Parameters
conversationConversationThe conversation to start.
resetConversationboolWhether to reset the conversation to the beginning.
StopCurrentDialog()
Stops the current dialog without firing finish events.
public void StopCurrentDialog()