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

Public Member Functions

 GVar (int[] idArray)
 
 GVar (GVar assetVar)
 
int AssignUniqueID (int[] idArray)
 Sets the internal ID to a unique number based on an array of previously-used values More...
 
void Download (VariableLocation _location=VariableLocation.Global, Variables _variables=null)
 Sets its value to that of its linked variable (if appropriate). More...
 
void Upload (VariableLocation _location=VariableLocation.Global, Variables _variables=null)
 Sets the value of its linked variable to its value (if appropriate). More...
 
void BackupValue ()
 
void RestoreBackupValue ()
 
void SetStringValue (string newValue, int newLineID=-1)
 Sets the value if its type is String. More...
 
void SetFloatValue (float newValue, SetVarMethod setVarMethod=SetVarMethod.SetValue)
 Sets the value if its type is Float. More...
 
void SetVector3Value (Vector3 newValue)
 Sets the value if its type is Vector3. More...
 
void SetValue (int newValue, SetVarMethod setVarMethod=SetVarMethod.SetValue)
 Sets the value if its type is Integer, Boolean or PopUp. More...
 
void CreateRuntimeTranslations ()
 Transfers translation data from RuntimeLanguages to the variable itself. This allows it to be transferred to other variables with the 'Variable: Copy' Action.
 
string [] GetTranslations ()
 Gets the variable's translations, if they exist. More...
 
void CopyFromVariable (GVar oldVar, VariableLocation oldLocation)
 Copies the value of another variable onto itself. More...
 
string GetValue (int languageNumber=0)
 Returns the variable's value. More...
 
string GetPopUpsString ()
 Gets all possible PopUp values as a single string, where the values are separated by a ']' character. More...
 
bool HasTranslations ()
 Checks if the Variable is translatable. More...
 
virtual string GetTranslatableString (int index)
 
virtual int GetTranslationID (int index)
 Gets the translation ID of a given text index. More...
 
bool IsGlobalVariable ()
 Checks if this Variable is defined under the Variable Manager's list of Global Variables More...
 
int GetNumTranslatables ()
 Gets the maximum number of possible translatable texts. More...
 
virtual bool HasExistingTranslation (int index)
 Checks if a given text index has already been assigned a unique translation ID. More...
 
virtual void SetTranslationID (int index, int _lineID)
 Sets the translation ID of a given text index More...
 
string GetOwner ()
 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 ()
 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...
 
virtual AC_TextType GetTranslationType (int index)
 Gets the translation type of a given text index. More...
 
virtual bool CanTranslate (int index)
 Checks if a given text index can and should be translated. More...
 
string [] GenerateEditorPopUpLabels ()
 

Public Attributes

string label
 
int id
 
VariableType type
 
int val
 
float floatVal
 
string textVal
 
string [] popUps
 
Vector3 vector3Val
 
VarLink link = VarLink.None
 
string pmVar
 
bool updateLinkOnStart = false
 
bool canTranslate = true
 
int textValLineID = -1
 
int popUpsLineID = -1
 
string description = ""
 
bool showInFilter
 

Properties

int IntegerValue [get, set]
 
bool BooleanValue [get, set]
 
float FloatValue [get, set]
 
string TextValue [get, set]
 
Vector3 Vector3Value [get, set]
 

Detailed Description

A data class for global and local variables. Variables are created in the Variables Manager asset file, and copied to the RuntimeVariables component when the game begins.

Constructor & Destructor Documentation

◆ GVar() [1/2]

AC.GVar.GVar ( int []  idArray)

The main Constructor. An array of ID numbers is required, to ensure its own ID is unique.

◆ GVar() [2/2]

AC.GVar.GVar ( GVar  assetVar)

A Constructor that copies all values from another variable. This way ensures that no connection remains to the asset file.

Member Function Documentation

◆ AssignUniqueID()

int AC.GVar.AssignUniqueID ( int []  idArray)

Sets the internal ID to a unique number based on an array of previously-used values

Parameters
idArrayAn array of previously-used ID values
Returns
The new ID number

>

◆ BackupValue()

void AC.GVar.BackupValue ( )

Backs up its value. Necessary when skipping ActionLists that involve checking variable values.

◆ CanTranslate()

virtual bool AC.GVar.CanTranslate ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ CopyFromVariable()

void AC.GVar.CopyFromVariable ( GVar  oldVar,
VariableLocation  oldLocation 
)

Copies the value of another variable onto itself.

Parameters
oldVarThe variable to copy from
oldLocationThe location of the variable to copy (Global, Local)

◆ Download()

void AC.GVar.Download ( VariableLocation  _location = VariableLocation.Global,
Variables  _variables = null 
)

Sets its value to that of its linked variable (if appropriate).

Parameters
_locationThe variable's location
_variablesThe variable's Variables component, if location = VariableLocation.Component

◆ GetNumTranslatables()

int AC.GVar.GetNumTranslatables ( )

Gets the maximum number of possible translatable texts.

Returns
The maximum number of possible translatable texts.

Implements AC.ITranslatable.

◆ GetOwner()

string AC.GVar.GetOwner ( )

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.

Returns
The name of the translatable text's owner.

Implements AC.ITranslatable.

◆ GetPopUpsString()

string AC.GVar.GetPopUpsString ( )

Gets all possible PopUp values as a single string, where the values are separated by a ']' character.

Returns
All possible PopUp values as a single string, where the values are separated by a ']' character.

◆ GetTranslatableString()

virtual string AC.GVar.GetTranslatableString ( int  index)
virtual

ITranslatable implementation

Implements AC.ITranslatable.

Reimplemented in AC.InvVar.

◆ GetTranslationID()

virtual int AC.GVar.GetTranslationID ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ GetTranslations()

string [] AC.GVar.GetTranslations ( )

Gets the variable's translations, if they exist.

Returns
The variable's translations, if they exist, as an array.

◆ GetTranslationType()

virtual AC_TextType AC.GVar.GetTranslationType ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ GetValue()

string AC.GVar.GetValue ( int  languageNumber = 0)

Returns the variable's value.

Returns
The value, as a formatted string.

◆ HasExistingTranslation()

virtual bool AC.GVar.HasExistingTranslation ( int  index)
virtual

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.

Reimplemented in AC.InvVar.

◆ HasTranslations()

bool AC.GVar.HasTranslations ( )

Checks if the Variable is translatable.

Returns
True if the Variable is translatable

◆ IsGlobalVariable()

bool AC.GVar.IsGlobalVariable ( )

Checks if this Variable is defined under the Variable Manager's list of Global Variables

Returns
True if the variable is Global

◆ OwnerIsPlayer()

bool AC.GVar.OwnerIsPlayer ( )

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.

Returns
True if the translatable text's owner is a Player.

Implements AC.ITranslatable.

◆ RestoreBackupValue()

void AC.GVar.RestoreBackupValue ( )

Restores its value from backup. Necessary when skipping ActionLists that involve checking variable values.

◆ SetFloatValue()

void AC.GVar.SetFloatValue ( float  newValue,
SetVarMethod  setVarMethod = SetVarMethod.SetValue 
)

Sets the value if its type is Float.

Parameters
newValueThe new float value
setVarMethodHow the new value affects the old (replaces, increases by, or randomises)

◆ SetStringValue()

void AC.GVar.SetStringValue ( string  newValue,
int  newLineID = -1 
)

Sets the value if its type is String.

Parameters
newValueThe new value of the string
newLineIDIf >=0, the translation ID used by SpeechManager / RuntimeLanguages will be updated to this value

◆ SetTranslationID()

virtual void AC.GVar.SetTranslationID ( int  index,
int  lineID 
)
virtual

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.

Reimplemented in AC.InvVar.

◆ SetValue()

void AC.GVar.SetValue ( int  newValue,
SetVarMethod  setVarMethod = SetVarMethod.SetValue 
)

Sets the value if its type is Integer, Boolean or PopUp.

Parameters
newValueThe new integer value
setVarMethodHow the new value affects the old (replaces, increases by, or randomises)

◆ SetVector3Value()

void AC.GVar.SetVector3Value ( Vector3  newValue)

Sets the value if its type is Vector3.

Parameters
newValueThe new Vector3 value

◆ Upload()

void AC.GVar.Upload ( VariableLocation  _location = VariableLocation.Global,
Variables  _variables = null 
)

Sets the value of its linked variable to its value (if appropriate).

Parameters
_locationThe variable's location
_variablesThe variable's Variables component, if location = VariableLocation.Component

Member Data Documentation

◆ canTranslate

bool AC.GVar.canTranslate = true

If True, the variable's value can be translated (if PopUp or String)

◆ floatVal

float AC.GVar.floatVal

Its value, if a float.

◆ id

int AC.GVar.id

Its internal ID number.

◆ label

string AC.GVar.label

Its editor name.

◆ link

VarLink AC.GVar.link = VarLink.None

What it links to, if a Global or Compnent Variable. A Variable can link to Options Data, or a Playmaker Variable.

◆ pmVar

string AC.GVar.pmVar

If linked to a Playmaker Variable, the name of the PM variable.

◆ popUps

string [] AC.GVar.popUps

An array of labels, if a popup.

◆ popUpsLineID

int AC.GVar.popUpsLineID = -1

The translation ID number of the variables's PopUp values (if type == VariableType.PopUp), as generated by SpeechManager

◆ textVal

string AC.GVar.textVal

Its value, if a string.

◆ textValLineID

int AC.GVar.textValLineID = -1

The translation ID number of the variable's string value (if type == VariableType.String), as generated by SpeechManager

◆ type

VariableType AC.GVar.type

Its variable type.

◆ updateLinkOnStart

bool AC.GVar.updateLinkOnStart = false

If True and linked to a PlayMaker Global Variable, then PM will be referred to for the initial value.

◆ val

int AC.GVar.val

Its value, if an integer, popup or boolean. If a boolean, 0 = False, and 1 = True.

◆ vector3Val

Vector3 AC.GVar.vector3Val

Its value, if a Vector3

Property Documentation

◆ BooleanValue

bool AC.GVar.BooleanValue
getset

Its value, if a boolean.

◆ FloatValue

float AC.GVar.FloatValue
getset

Its value, if a float.

◆ IntegerValue

int AC.GVar.IntegerValue
getset

Its value, if an integer.

◆ TextValue

string AC.GVar.TextValue
getset

Its value, if a string.

◆ Vector3Value

Vector3 AC.GVar.Vector3Value
getset

Its value, if a Vector3.