|
|
@ -606,6 +606,7 @@ namespace Fungus |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Debug.LogWarning("Variable " + key + " not found."); |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -626,174 +627,6 @@ namespace Fungus |
|
|
|
return publicVariables; |
|
|
|
return publicVariables; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Gets the value of a boolean variable. |
|
|
|
|
|
|
|
* Returns false if the variable key does not exist. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual bool GetBooleanVariable(string key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (Variable v in variables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (v != null && v.key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
BooleanVariable variable = v as BooleanVariable; |
|
|
|
|
|
|
|
if (variable != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return variable.value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.LogWarning("Boolean variable " + key + " not found."); |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Sets the value of a boolean variable. |
|
|
|
|
|
|
|
* The variable must already be added to the list of variables for this Flowchart. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual void SetBooleanVariable(string key, bool value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (Variable v in variables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (v != null && v.key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
BooleanVariable variable = v as BooleanVariable; |
|
|
|
|
|
|
|
if (variable != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
variable.value = value; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.LogWarning("Boolean variable " + key + " not found."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Gets the value of an integer variable. |
|
|
|
|
|
|
|
* Returns 0 if the variable key does not exist. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual int GetIntegerVariable(string key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (Variable v in variables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (v != null && v.key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IntegerVariable variable = v as IntegerVariable; |
|
|
|
|
|
|
|
if (variable != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return variable.value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.LogWarning("Integer variable " + key + " not found."); |
|
|
|
|
|
|
|
return 0; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Sets the value of an integer variable. |
|
|
|
|
|
|
|
* The variable must already be added to the list of variables for this Flowchart. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual void SetIntegerVariable(string key, int value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (Variable v in variables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (v != null && v.key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
IntegerVariable variable = v as IntegerVariable; |
|
|
|
|
|
|
|
if (variable != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
variable.value = value; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.LogWarning("Integer variable " + key + " not found."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Gets the value of a float variable. |
|
|
|
|
|
|
|
* Returns 0 if the variable key does not exist. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual float GetFloatVariable(string key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (Variable v in variables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (v != null && v.key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
FloatVariable variable = v as FloatVariable; |
|
|
|
|
|
|
|
if (variable != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return variable.value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.LogWarning("Float variable " + key + " not found."); |
|
|
|
|
|
|
|
return 0f; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Sets the value of a float variable. |
|
|
|
|
|
|
|
* The variable must already be added to the list of variables for this Flowchart. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual void SetFloatVariable(string key, float value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (Variable v in variables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (v != null && v.key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
FloatVariable variable = v as FloatVariable; |
|
|
|
|
|
|
|
if (variable != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
variable.value = value; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.LogWarning("Float variable " + key + " not found."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Gets the value of a string variable. |
|
|
|
|
|
|
|
* Returns the empty string if the variable key does not exist. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual string GetStringVariable(string key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (Variable v in variables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (v != null && v.key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
StringVariable variable = v as StringVariable; |
|
|
|
|
|
|
|
if (variable != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
return variable.value; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.LogWarning("String variable " + key + " not found."); |
|
|
|
|
|
|
|
return ""; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* Sets the value of a string variable. |
|
|
|
|
|
|
|
* The variable must already be added to the list of variables for this Flowchart. |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
public virtual void SetStringVariable(string key, string value) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (Variable v in variables) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (v != null && v.key == key) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
StringVariable variable = v as StringVariable; |
|
|
|
|
|
|
|
if (variable != null) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
variable.value = value; |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Debug.LogWarning("String variable " + key + " not found."); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Set the block objects to be hidden or visible depending on the hideComponents property. |
|
|
|
* Set the block objects to be hidden or visible depending on the hideComponents property. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|