Adventure Creator  1.69.3
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2018
AC.Speech Class Reference

Public Member Functions

 Speech (Char _speaker, string _message, int lineID, bool _isBackground, bool _noAnimation, bool _preventSkipping=false)
 The default Constructor. More...
 
 Speech (string _message)
 A special-case Constructor purely used to display text without tags when exporting script-sheets. More...
 
 Speech (AC.Char _speaker, string _message)
 
void UpdateVolume ()
 
void UpdateDisplay ()
 
void EndPause ()
 
bool HasConditions (SpeechMenuLimit speechMenuLimit, SpeechMenuType speechMenuType, string limitToCharacters, SpeechProximityLimit speechProximityLimit=SpeechProximityLimit.NoLimit, float speechProximityDistance=0f)
 Checks if the speech line matches certain conditions. More...
 
void UpdateInput ()
 Updates the state of the Speech based on the user's input. This is called every Update call by StateHandler.
 
void EndBackgroundSpeechAudio (AC.Char newSpeaker)
 Ends speech audio, if it is playing in the background. More...
 
void EndSpeechAudio ()
 Ends speech audio, regardless of conditions.
 
string GetSpeaker (int languageNumber=0)
 Gets the display name of the speaking character. More...
 
Color GetColour ()
 Gets the colour of the subtitle text. More...
 
AC.Char GetSpeakingCharacter ()
 Gets the speaking character. More...
 
bool IsPaused ()
 Checks if the speech line is temporarily paused, due to a [wait] or [wait:X] token. More...
 
UnityEngine.Sprite GetPortraitSprite ()
 Gets a Sprite based on the portrait graphic of the speaking character. If lipsincing is enabled, the sprite will be based on the current phoneme. More...
 
Texture GetPortrait ()
 Gets the portrait graphic of the speaking character. More...
 
bool IsAnimating ()
 Checks if the speaking character's portrait graphic can be animated. More...
 
Rect GetAnimatedRect ()
 Gets a Rect of the character's portrait graphic. If the graphic is animating, only the relevant portion will be returned. More...
 
void ReplaceDisplayText (string newDisplayText, bool resetScrollAmount=true)
 Replaces the speech's display text. Note that this will not affect audio or lipsyncing More...
 
bool MenuCanShow (Menu menu)
 Checks if a Menu is able to show this speech line. More...
 

Public Attributes

SpeechLog log
 
bool isAlive
 
bool continueFromSpeech = false
 

Protected Member Functions

void ExtendTime ()
 
void StopScrolling ()
 
void SetPauseGap ()
 
string DetermineGaps (string _text)
 
string DetermineRichTextTags (string _text, string[] tagNames)
 
string FindSpeakerTag (string _message, string _speakerName)
 
void CorrectPreviousGaps (int minCharIndex, int offset)
 
float FloatParse (string text)
 
bool IsBackgroundSpeech ()
 
bool CanScroll ()
 
void EndMessage (bool forceOff=false)
 
bool SkipSpeechInput ()
 
void InitSpeech (string _message, bool resetScrollAmount)
 
bool HasPassedIndex (int indexToCheck)
 
string GetTextPortion (string fullText, int index)
 
float GetLengthWithoutRichText (string _message)
 
float GetTotalWaitTokenDuration ()
 

Protected Attributes

int gapIndex = -1
 
int continueIndex = -1
 
List< SpeechGapspeechGaps = new List<SpeechGap>()
 
float endTime
 
float continueTime
 
float minSkipTime
 
bool preventSkipping = false
 
bool usingRichText = false
 
bool isSkippable
 
bool pauseGap
 
bool holdForever = false
 
float scrollAmount = 0f
 
float pauseEndTime = 0f
 
bool pauseIsIndefinite = false
 
AudioSource audioSource = null
 
bool isRTL = false
 
int currentCharIndex = 0
 
float minDisplayTime
 
string realName
 

Properties

string displayText [get, protected set]
 
bool isBackground [get, protected set]
 
bool hasAudio [get, protected set]
 
AC.Char speaker [get, protected set]
 
string SpeakerName [get]
 
int LineID [get]
 
string FullText [get]
 

Detailed Description

A container class for an active line of dialogue.

Constructor & Destructor Documentation

◆ Speech() [1/2]

AC.Speech.Speech ( Char  _speaker,
string  _message,
int  lineID,
bool  _isBackground,
bool  _noAnimation,
bool  _preventSkipping = false 
)

The default Constructor.

Parameters
_speakerThe speaking character. If null, the line is considered a narration
_messageThe subtitle text to display
lineIDThe unique ID number of the line, as generated by the Speech Manager
_isBackgroundTrue if the line should play in the background, and not interrupt Actions or gameplay
_noAnimationTrue if the speaking character should not play a talking animation
_preventSkippingTrue if the speech cannot be skipped regardless of subtitle settings in the Speech Manager

◆ Speech() [2/2]

AC.Speech.Speech ( string  _message)

A special-case Constructor purely used to display text without tags when exporting script-sheets.

Parameters
_messageThe subtitle text to display

Member Function Documentation

◆ EndBackgroundSpeechAudio()

void AC.Speech.EndBackgroundSpeechAudio ( AC.Char  newSpeaker)

Ends speech audio, if it is playing in the background.

Parameters
newSpeakerIf the line's speaker matches this, the audio will not end

◆ EndPause()

void AC.Speech.EndPause ( )

Ends the current pause.

◆ GetAnimatedRect()

Rect AC.Speech.GetAnimatedRect ( )

Gets a Rect of the character's portrait graphic. If the graphic is animating, only the relevant portion will be returned.

Returns
A Rect of the character's portrait graphic

◆ GetColour()

Color AC.Speech.GetColour ( )

Gets the colour of the subtitle text.

Returns
The colour of the subtitle text

◆ GetPortrait()

Texture AC.Speech.GetPortrait ( )

Gets the portrait graphic of the speaking character.

Returns
The speaking character's portrait graphic

◆ GetPortraitSprite()

UnityEngine.Sprite AC.Speech.GetPortraitSprite ( )

Gets a Sprite based on the portrait graphic of the speaking character. If lipsincing is enabled, the sprite will be based on the current phoneme.

Returns
The speaking character's portrait sprite

◆ GetSpeaker()

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

Gets the display name of the speaking character.

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

◆ GetSpeakingCharacter()

AC.Char AC.Speech.GetSpeakingCharacter ( )

Gets the speaking character.

Returns
The speaking character

◆ HasConditions()

bool AC.Speech.HasConditions ( SpeechMenuLimit  speechMenuLimit,
SpeechMenuType  speechMenuType,
string  limitToCharacters,
SpeechProximityLimit  speechProximityLimit = SpeechProximityLimit.NoLimit,
float  speechProximityDistance = 0f 
)

Checks if the speech line matches certain conditions.

Parameters
speechMenuLimitWhat kind of speech has to play for this Menu to enable (All, BlockingOnly, BackgroundOnly)
speechMenuTypeWhat kind of speaker has to be speaking for this Menu to enable (All, CharactersOnly, NarrationOnly, SpecificCharactersOnly)
limitToCharactersA list of character names that this Menu will show for, if speechMenuType = SpeechMenuType.SpecificCharactersOnly
speechProximityLimitWhether or not the distance the Player/MainCamera is from the speaking character affects display
speechProximityDistanceThe maximum distance if speechProximityLimit != SpeechProximityLimit.NoLimit"
Returns
True if the speech line matches the conditions

◆ IsAnimating()

bool AC.Speech.IsAnimating ( )

Checks if the speaking character's portrait graphic can be animated.

Returns
True if the character's portrait graphic can be animated

◆ IsPaused()

bool AC.Speech.IsPaused ( )

Checks if the speech line is temporarily paused, due to a [wait] or [wait:X] token.

Returns
True if the speech line is temporarily paused.

◆ MenuCanShow()

bool AC.Speech.MenuCanShow ( Menu  menu)

Checks if a Menu is able to show this speech line.

Parameters
menuThe Menu to check against
Returns
True if the Menu is able to show this speech line

◆ ReplaceDisplayText()

void AC.Speech.ReplaceDisplayText ( string  newDisplayText,
bool  resetScrollAmount = true 
)

Replaces the speech's display text. Note that this will not affect audio or lipsyncing

Parameters
newSpeechTextThe new display text
resetScrollAmountIf True, then the amount by which the text has scrolled will be reset

◆ UpdateDisplay()

void AC.Speech.UpdateDisplay ( )

Updates the state of the line. This is called every LateUpdate call by StateHandler.

◆ UpdateVolume()

void AC.Speech.UpdateVolume ( )

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

Member Data Documentation

◆ continueFromSpeech

bool AC.Speech.continueFromSpeech = false

If True, then the Action that ran this speech will end, but the speech line is still active

◆ isAlive

bool AC.Speech.isAlive

True if the line is active

◆ log

SpeechLog AC.Speech.log

The line's SpeechLog entry

Property Documentation

◆ displayText

string AC.Speech.displayText
getprotected set

The display text

◆ FullText

string AC.Speech.FullText
get

The full display text of the line

◆ hasAudio

bool AC.Speech.hasAudio
getprotected set

If True, the speech line has an AudioClip supplied

◆ isBackground

bool AC.Speech.isBackground
getprotected set

True if the line should play in the backround, and not interrupt Actions or gameplay.

◆ LineID

int AC.Speech.LineID
get

The ID number of the line, as set by the Speech Manager

◆ speaker

AC.Char AC.Speech.speaker
getprotected set

The characters speaking the line, unless a narration

◆ SpeakerName

string AC.Speech.SpeakerName
get

The display name of the speaking character