Adventure Creator  1.79.1
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2022
AC.LocalVariables Class Reference
Inheritance diagram for AC.LocalVariables:
AC.ITranslatable

Public Member Functions

void OnInitGameEngine ()
 
void BackupAllValues ()
 
void AssignFromPreset (VarPreset varPreset)
 Assigns all Local Variables to preset values. More...
 
void AssignFromPreset (int varPresetID)
 Assigns all Local Variables to preset values. More...
 
VarPreset GetPreset (int varPresetID)
 Gets a Local Variable preset with a specific ID number. More...
 
string GetTranslatableString (int index)
 Gets the text to be translated, given its index. More...
 
int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
void UpdateTranslatableString (int index, string updatedText)
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
void SetTranslationID (int index, int _lineID)
 Sets the translation ID of a given text index More...
 
string GetOwner (int index)
 Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element. More...
 
bool OwnerIsPlayer (int index)
 Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line. More...
 
AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
bool CanTranslate (int index)
 Checks if a given text index can and should be translated. More...
 

Static Public Member Functions

static GVar GetVariable (int _id, LocalVariables localVariables=null)
 Returns a local variable. More...
 
static GVar GetVariable (string _name, LocalVariables localVariables=null)
 Returns a local variable. More...
 
static List< GVarGetAllVars ()
 Returns a list of all local variables. More...
 
static int GetIntegerValue (int _id)
 Returns the value of a local Integer variable. More...
 
static bool GetBooleanValue (int _id)
 Returns the value of a local Boolean variable. More...
 
static string GetStringValue (int _id, int lanugageNumber=0)
 Returns the value of a local String variable. More...
 
static float GetFloatValue (int _id)
 Returns the value of a local Float variable. More...
 
static Vector3 GetVector3Value (int _id)
 Returns the value of a local Vector3 variable. More...
 
static string GetPopupValue (int _id, int languageNumber=0)
 Returns the value of a local Popup variable. More...
 
static void SetIntegerValue (int _id, int _value)
 Sets the value of a local Integer variable. More...
 
static void SetBooleanValue (int _id, bool _value)
 Sets the value of a local Boolean variable. More...
 
static void SetStringValue (int _id, string _value)
 Sets the value of a local String variable. More...
 
static void SetFloatValue (int _id, float _value)
 Sets the value of a local Float variable. More...
 
static void SetVector3Value (int _id, Vector3 _value)
 Sets the value of a local Vector3 variable. More...
 
static void SetPopupValue (int _id, int _value)
 Sets the value of a local PopUp variable. More...
 

Public Attributes

List< GVarlocalVars = new List<GVar>()
 
List< VarPresetvarPresets = new List<VarPreset>()
 

Detailed Description

Stores a scene's local variables. This component should be attached to the GameEngine prefab.

Member Function Documentation

◆ AssignFromPreset() [1/2]

void AC.LocalVariables.AssignFromPreset ( int  varPresetID)

Assigns all Local Variables to preset values.

Parameters
varPresetIDThe ID number of the VarPreset that contains the preset values

◆ AssignFromPreset() [2/2]

void AC.LocalVariables.AssignFromPreset ( VarPreset  varPreset)

Assigns all Local Variables to preset values.

Parameters
varPresetThe VarPreset that contains the preset values

◆ BackupAllValues()

void AC.LocalVariables.BackupAllValues ( )

Backs up the values of all local variables. Necessary when skipping ActionLists that involve checking variable values.

◆ CanTranslate()

bool AC.LocalVariables.CanTranslate ( int  index)

Checks if a given text index can and should be translated.

Parameters
indexThe index of the translatable text
Returns
True if the text can and should be translated

Implements AC.ITranslatable.

◆ GetAllVars()

static List<GVar> AC.LocalVariables.GetAllVars ( )
static

Returns a list of all local variables.

Returns
A List of GVar variables

◆ GetBooleanValue()

static bool AC.LocalVariables.GetBooleanValue ( int  _id)
static

Returns the value of a local Boolean variable.

Parameters
_idThe ID number of the variable
Returns
The boolean value of the variable

◆ GetFloatValue()

static float AC.LocalVariables.GetFloatValue ( int  _id)
static

Returns the value of a local Float variable.

Parameters
_idThe ID number of the variable
Returns
The float value of the variable

◆ GetIntegerValue()

static int AC.LocalVariables.GetIntegerValue ( int  _id)
static

Returns the value of a local Integer variable.

Parameters
_idThe ID number of the variable
Returns
The integer value of the variable

◆ GetNumTranslatables()

int AC.LocalVariables.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetOwner()

string AC.LocalVariables.GetOwner ( int  index)

Gets the name of the translatable text's owner. In the case of speech text, it is the name of the character. In the case of menu element text, it is the name of the menu element.

Parameters
indexThe index of the translatable text
Returns
The name of the translatable text's owner.

Implements AC.ITranslatable.

◆ GetPopupValue()

static string AC.LocalVariables.GetPopupValue ( int  _id,
int  languageNumber = 0 
)
static

Returns the value of a local Popup variable.

Parameters
_idThe ID number of the variable
languageNumberThe index number of the game's current language
Returns
The string value of the variable

◆ GetPreset()

VarPreset AC.LocalVariables.GetPreset ( int  varPresetID)

Gets a Local Variable preset with a specific ID number.

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

◆ GetStringValue()

static string AC.LocalVariables.GetStringValue ( int  _id,
int  lanugageNumber = 0 
)
static

Returns the value of a local String variable.

Parameters
_idThe ID number of the variable
languageNumberThe index number of the game's current language
Returns
The string value of the variable

◆ GetTranslatableString()

string AC.LocalVariables.GetTranslatableString ( int  index)

Gets the text to be translated, given its index.

Parameters
indexThe index of the translatable text
Returns
The text to be translated

Implements AC.ITranslatable.

◆ GetTranslationID()

int AC.LocalVariables.GetTranslationID ( int  index)

Gets the translation ID of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation ID of the text

Implements AC.ITranslatable.

◆ GetTranslationType()

AC_TextType AC.LocalVariables.GetTranslationType ( int  index)

Gets the translation type of a given text index.

Parameters
indexThe index of the translatable text
Returns
The translation type of a given text index.

Implements AC.ITranslatable.

◆ GetVariable() [1/2]

static GVar AC.LocalVariables.GetVariable ( int  _id,
LocalVariables  localVariables = null 
)
static

Returns a local variable.

Parameters
_idThe ID number of the variable
localVariablesThe LocalVariables script to read from, if not the active scene's GameEngine
Returns
The local variable, or null if it was not found

◆ GetVariable() [2/2]

static GVar AC.LocalVariables.GetVariable ( string  _name,
LocalVariables  localVariables = null 
)
static

Returns a local variable.

Parameters
_nameThe name of the variable
localVariablesThe LocalVariables script to read from, if not the active scene's GameEngine
Returns
The local variable, or null if it was not found

◆ GetVector3Value()

static Vector3 AC.LocalVariables.GetVector3Value ( int  _id)
static

Returns the value of a local Vector3 variable.

Parameters
_idThe ID number of the variable
Returns
The Vector3 value of the variable

◆ HasExistingTranslation()

bool AC.LocalVariables.HasExistingTranslation ( int  index)

Checks if a given text index has already been assigned a unique translation ID.

Parameters
indexThe index of the translatable text
Returns
True if the text has been assigned a unique translation ID

Implements AC.ITranslatable.

◆ OnInitGameEngine()

void AC.LocalVariables.OnInitGameEngine ( )

Creates run-time translations of local variables.

◆ OwnerIsPlayer()

bool AC.LocalVariables.OwnerIsPlayer ( int  index)

Checks if the translatable text's owner is a Player. This is necessary for speech lines, since multiple player prefabs can feasibly share the same line.

Parameters
indexThe index of the translatable text
Returns
True if the translatable text's owner is a Player.

Implements AC.ITranslatable.

◆ SetBooleanValue()

static void AC.LocalVariables.SetBooleanValue ( int  _id,
bool  _value 
)
static

Sets the value of a local Boolean variable.

Parameters
_idThe ID number of the variable
_valueThe new bool value of the variable

◆ SetFloatValue()

static void AC.LocalVariables.SetFloatValue ( int  _id,
float  _value 
)
static

Sets the value of a local Float variable.

Parameters
_idThe ID number of the variable
_valueThe new float value of the variable

◆ SetIntegerValue()

static void AC.LocalVariables.SetIntegerValue ( int  _id,
int  _value 
)
static

Sets the value of a local Integer variable.

Parameters
_idThe ID number of the variable
_valueThe new integer value of the variable

◆ SetPopupValue()

static void AC.LocalVariables.SetPopupValue ( int  _id,
int  _value 
)
static

Sets the value of a local PopUp variable.

Parameters
_idThe ID number of the variable
_valueThe new index value of the variable

◆ SetStringValue()

static void AC.LocalVariables.SetStringValue ( int  _id,
string  _value 
)
static

Sets the value of a local String variable.

_id">The ID number of the variable</param> <param>_value">The new string value of the variable

◆ SetTranslationID()

void AC.LocalVariables.SetTranslationID ( int  index,
int  lineID 
)

Sets the translation ID of a given text index

Parameters
indexThe index of the translatable text
lineIDThe new translation ID to assign the translatable text

Implements AC.ITranslatable.

◆ SetVector3Value()

static void AC.LocalVariables.SetVector3Value ( int  _id,
Vector3  _value 
)
static

Sets the value of a local Vector3 variable.

Parameters
_idThe ID number of the variable
_valueThe new Vector3 value of the variable

Member Data Documentation

◆ localVars

List<GVar> AC.LocalVariables.localVars = new List<GVar>()

The List of local variables in the scene.

◆ varPresets

List<VarPreset> AC.LocalVariables.varPresets = new List<VarPreset>()

A List of preset values that the variables can be bulk-assigned to