Adventure Creator  1.66.8
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.Dialog Class Reference
Inheritance diagram for AC.Dialog:

Public Member Functions

void OnAwake ()
 
void _Update ()
 
void _LateUpdate ()
 
void UpdateSpeechVolumes ()
 
Speech StartDialog (Char _speaker, string _text, bool isBackground=false, int lineID=-1, bool noAnimation=false, bool preventSkipping=false)
 Initialises a new Speech line. More...
 
Speech StartDialog (Char _speaker, int lineID, bool isBackground=false, bool noAnimation=false)
 Initialises a new Speech line. This differs from the other StartDialog function in that it requires a lineID, which must be present in the Speech Manager and is used to source the line's actual text. More...
 
AudioSource GetNarratorAudioSource ()
 Gets, and creates if necessary, an AudioSource used for Narration speech. If the narratorSound variable is empty, one will be generated and its AudioSource referenced. More...
 
void PlayScrollAudio (AC.Char _speaker)
 Plays text-scoll audio for a given character. If no character is speaking, narration text-scroll audio will be played instead. More...
 
Speech GetLatestSpeech ()
 Gets the last Speech line to be played. More...
 
Speech GetLiveSpeechWithID (int lineID)
 Gets a speech line with a specific ID, that's currently being spoken More...
 
bool FoundAudio ()
 Checks if any of the active Speech lines have audio. More...
 
bool IsAnySpeechPlaying (bool ignoreBackgroundSpeech=false)
 Checks if any speech is currently playing. More...
 
string GetSpeaker (int languageNumber=0)
 Gets the display name of the most recently-speaking character. More...
 
bool CharacterIsSpeaking (Char _char)
 Checks if a given character is speaking. More...
 
AC.Char GetSpeakingCharacter ()
 Gets the most recently-speaking character. More...
 
bool AudioIsPlaying ()
 Checks if any of the active Speech lines have audio and are playing it. More...
 
void KillDialog (bool stopCharacter, bool forceMenusOff, SpeechMenuLimit speechMenuLimit=SpeechMenuLimit.All, SpeechMenuType speechMenuType=SpeechMenuType.All, string limitToCharacters="")
 Kills all active Speech lines. More...
 
void KillDialog (Speech speech)
 Kills a given Speech line. More...
 
List< LipSyncShapeGenerateLipSyncShapes (LipSyncMode _lipSyncMode, int lineID, Char _speaker, string language="", string _message="")
 Generates the animation data for lipsyncing a given Speech line. More...
 
void EndSpeechByCharacter (Char character)
 Ends speech spoken by a given character More...
 

Public Attributes

List< SpeechspeechList = new List<Speech>()
 
Sound narratorSound
 
float conversationDelay = 0.3f
 
string [] richTextTags
 

Properties

string [] SpeechEventTokenKeys [get, set]
 

Detailed Description

Manages the creation, updating, and removal of all Speech lines. It should be placed on the GameEngine prefab.

Member Function Documentation

◆ _Update()

void AC.Dialog._Update ( )

Updates all active Speech lines. This is called every frame by StateHandler.

◆ AudioIsPlaying()

bool AC.Dialog.AudioIsPlaying ( )

Checks if any of the active Speech lines have audio and are playing it.

Returns
True if any active Speech lines have audio and are playing it

◆ CharacterIsSpeaking()

bool AC.Dialog.CharacterIsSpeaking ( Char  _char)

Checks if a given character is speaking.

<param name = "_char".The character to check

Returns
True if the character is speaking

◆ EndSpeechByCharacter()

void AC.Dialog.EndSpeechByCharacter ( Char  character)

Ends speech spoken by a given character

Parameters
characterThe character to stop speaking

◆ FoundAudio()

bool AC.Dialog.FoundAudio ( )

Checks if any of the active Speech lines have audio.

Returns
True if any active Speech lines have audio

◆ GenerateLipSyncShapes()

List<LipSyncShape> AC.Dialog.GenerateLipSyncShapes ( LipSyncMode  _lipSyncMode,
int  lineID,
Char  _speaker,
string  language = "",
string  _message = "" 
)

Generates the animation data for lipsyncing a given Speech line.

Parameters
_lipSyncModeThe chosen method of lipsyncing (Off, FromSpeechText, ReadPamelaFile, ReadSapiFile, ReadPapagayoFile, FaceFX, Salsa2D)
lineNumberThe speech line's ID number
_speakerThe speaking character
languageThe name of the current language
_messageThe speech text</param<
Returns
A List of LipSyncShape structs that contain the lipsync animation data

◆ GetLatestSpeech()

Speech AC.Dialog.GetLatestSpeech ( )

Gets the last Speech line to be played.

Returns
The last item in the speechList List

◆ GetLiveSpeechWithID()

Speech AC.Dialog.GetLiveSpeechWithID ( int  lineID)

Gets a speech line with a specific ID, that's currently being spoken

Parameters
lineIDThe ID number of the speech line to get
Returns
The active speech line

◆ GetNarratorAudioSource()

AudioSource AC.Dialog.GetNarratorAudioSource ( )

Gets, and creates if necessary, an AudioSource used for Narration speech. If the narratorSound variable is empty, one will be generated and its AudioSource referenced.

Returns
The AudioSource for Narration speech

◆ GetSpeaker()

string AC.Dialog.GetSpeaker ( int  languageNumber = 0)

Gets the display name of the most recently-speaking character.

Parameters
languageNumberThe index number of the language number to get the text in
Returns
The character's display name

◆ GetSpeakingCharacter()

AC.Char AC.Dialog.GetSpeakingCharacter ( )

Gets the most recently-speaking character.

Returns
The character

◆ IsAnySpeechPlaying()

bool AC.Dialog.IsAnySpeechPlaying ( bool  ignoreBackgroundSpeech = false)

Checks if any speech is currently playing.

Parameters
ignoreBackgroundSpeechIf True, then only gameplay-blocking speech will be accounted for
Returns
True if any speech is currently playing

◆ KillDialog() [1/2]

void AC.Dialog.KillDialog ( bool  stopCharacter,
bool  forceMenusOff,
SpeechMenuLimit  speechMenuLimit = SpeechMenuLimit.All,
SpeechMenuType  speechMenuType = SpeechMenuType.All,
string  limitToCharacters = "" 
)

Kills all active Speech lines.

Parameters
stopCharacterIf True, then all characters speaking will cease their talking animation
forceMenusOffTrue if subtitles should be turned off immediately
speechMenuLimitThe type of speech to kill (All, BlockingOnly, BackgroundOnly)

◆ KillDialog() [2/2]

void AC.Dialog.KillDialog ( Speech  speech)

Kills a given Speech line.

Parameters
speechThe Speech class instance to end.
stopCharacterIf True, then the speaking character will cease their talking animation

◆ PlayScrollAudio()

void AC.Dialog.PlayScrollAudio ( AC.Char  _speaker)

Plays text-scoll audio for a given character. If no character is speaking, narration text-scroll audio will be played instead.

Parameters
_speakerThe speaking character

◆ StartDialog() [1/2]

Speech AC.Dialog.StartDialog ( Char  _speaker,
string  _text,
bool  isBackground = false,
int  lineID = -1,
bool  noAnimation = false,
bool  preventSkipping = false 
)

Initialises a new Speech line.

Parameters
_speakerThe speaking character. If null, the line will be treated as narration
_textThe subtitle text to display
isBackgroundTrue if the line should play in the background, and not interrupt any Actions or gameplay
lineIDThe ID number of the line, if it is listed in the Speech Manager
noAnimationTrue if the character should not play a talking animation
preventSkippingTrue if the speech cannot be skipped regardless of subtitle settings in the Speech Manager
Returns
The generated Speech line

◆ StartDialog() [2/2]

Speech AC.Dialog.StartDialog ( Char  _speaker,
int  lineID,
bool  isBackground = false,
bool  noAnimation = false 
)

Initialises a new Speech line. This differs from the other StartDialog function in that it requires a lineID, which must be present in the Speech Manager and is used to source the line's actual text.

Parameters
_speakerThe speaking character. If null, the line will be treated as narration
lineIDThe ID number of the line, if it is listed in the Speech Manager
isBackgroundTrue if the line should play in the background, and not interrupt any Actions or gameplay
noAnimationTrue if the character should not play a talking animation
Returns
The generated Speech line

◆ UpdateSpeechVolumes()

void AC.Dialog.UpdateSpeechVolumes ( )

Updates all speech volumes to the level set in Options. This should be called whenever the Speech volume level is changed.

Member Data Documentation

◆ conversationDelay

float AC.Dialog.conversationDelay = 0.3f

The delay in seconds between choosing a Conversation's dialogue option and it triggering

◆ narratorSound

Sound AC.Dialog.narratorSound

The Sound prefab to use to play narration speech audio from

◆ richTextTags

string [] AC.Dialog.richTextTags
Initial value:
= new string[]
{
"b",
"i",
"size=",
"color="
}

An array of rich-text tag names that can be detected when scrolling speech, to prevent them from displaying incorrectly. If a name ends with an '=' symbol, the tag has a parameter

◆ speechList

List<Speech> AC.Dialog.speechList = new List<Speech>()

A List of all active Speech lines

Property Documentation

◆ SpeechEventTokenKeys

string [] AC.Dialog.SpeechEventTokenKeys
getset

An array of string keys that can be inserted into speech text in the form [key:value]. When processed by the speech display, they will be removed from the speech, but will trigger the OnSpeechToken event.