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

Public Member Functions

void OnStart ()
 
SpeechLog [] GetSpeechLog ()
 Gets the game's speech log. More...
 
void ClearSpeechLog ()
 
void AddToSpeechLog (SpeechLog _line)
 Adds a speech line to the game's speech log. More...
 
void SetCustomToken (int _ID, string _replacementText)
 Creates a new custom token, or replaces it if one with the same ID number already exists. More...
 
void ClearCustomTokens ()
 Removes all custom tokens from the game.
 
string ConvertCustomTokens (string _text)
 Replaces the supplied string with the replacementText of any defined CustomToken classes. More...
 
void AssignCustomTokensFromString (string tokenData)
 Re-assigns the CustomToken variables from a saved string. More...
 
void AssignOptionsLinkedVariabes ()
 Transfers the values of all option-linked global variables from the options data into the variables.
 
MainData SaveMainData (MainData mainData)
 Updates a MainData class with its own variables that need saving. More...
 
void AssignFromPreset (VarPreset varPreset, bool ignoreOptionLinked=false)
 Assigns all Global Variables to preset values. More...
 
void AssignFromPreset (int varPresetID, bool ignoreOptionLinked=false)
 Assigns all Glocal Variables to preset values. More...
 
VarPreset GetPreset (int varPresetID)
 Gets a Global Variable preset with a specific ID number. More...
 

Public Attributes

List< GVarglobalVars = new List<GVar>()
 

Detailed Description

Stores the game's global variables at runtime, as well as the speech log. This component should be attached to the PersistentEngine prefab.

Member Function Documentation

◆ AddToSpeechLog()

void AC.RuntimeVariables.AddToSpeechLog ( SpeechLog  _line)

Adds a speech line to the game's speech log.

Parameters
_lineThe SpeechLog variable to add

◆ AssignCustomTokensFromString()

void AC.RuntimeVariables.AssignCustomTokensFromString ( string  tokenData)

Re-assigns the CustomToken variables from a saved string.

Parameters
savedStringThe string that contains the CustomToken variables data

◆ AssignFromPreset() [1/2]

void AC.RuntimeVariables.AssignFromPreset ( VarPreset  varPreset,
bool  ignoreOptionLinked = false 
)

Assigns all Global Variables to preset values.

Parameters
varPresetThe VarPreset that contains the preset values
ignoreOptionLinkedIf True, then variables linked to Options Data will not be affected

◆ AssignFromPreset() [2/2]

void AC.RuntimeVariables.AssignFromPreset ( int  varPresetID,
bool  ignoreOptionLinked = false 
)

Assigns all Glocal Variables to preset values.

Parameters
varPresetIDThe ID number of the VarPreset that contains the preset values
ignoreOptionLinkedIf True, then variables linked to Options Data will not be affected

◆ ClearSpeechLog()

void AC.RuntimeVariables.ClearSpeechLog ( )

Clears the game's speech log.

◆ ConvertCustomTokens()

string AC.RuntimeVariables.ConvertCustomTokens ( string  _text)

Replaces the supplied string with the replacementText of any defined CustomToken classes.

Parameters
_textThe supplied string that may contain tokens of the form '[token:ID]'
Returns
The supplied string with any tokens replaced with the appropriate CustomToken's replacementText

◆ GetPreset()

VarPreset AC.RuntimeVariables.GetPreset ( int  varPresetID)

Gets a Global Variable preset with a specific ID number.

Parameters
varPresetIDThe ID number of the VarPreset
Returns
The Global Variable preset

◆ GetSpeechLog()

SpeechLog [] AC.RuntimeVariables.GetSpeechLog ( )

Gets the game's speech log.

Returns
An array of SpeechLog variables

◆ OnStart()

void AC.RuntimeVariables.OnStart ( )

Downloads variables from the Global Manager to the scene. This is public because it is also called when the game is restarted.

◆ SaveMainData()

MainData AC.RuntimeVariables.SaveMainData ( MainData  mainData)

Updates a MainData class with its own variables that need saving.

Parameters
mainDataThe original MainData class
Returns
The updated MainData class

◆ SetCustomToken()

void AC.RuntimeVariables.SetCustomToken ( int  _ID,
string  _replacementText 
)

Creates a new custom token, or replaces it if one with the same ID number already exists.

Parameters
_IDThe token's unique identifier
_replacementTextThe token's replacement text.

Member Data Documentation

◆ globalVars

List<GVar> AC.RuntimeVariables.globalVars = new List<GVar>()

The List of the game's global variables.