public override void AssignValues(List <ActionParameter> parameters) { intValue = AssignInteger(parameters, checkParameterID, intValue); boolValue = AssignBoolean(parameters, checkParameterID, boolValue); floatValue = AssignFloat(parameters, checkParameterID, floatValue); vector3Value = AssignVector3(parameters, checkParameterID, vector3Value); stringValue = AssignString(parameters, checkParameterID, stringValue); runtimeVariable = null; switch (location) { case VariableLocation.Global: variableID = AssignVariableID(parameters, parameterID, variableID); runtimeVariable = GlobalVariables.GetVariable(variableID, true); break; case VariableLocation.Local: if (!isAssetFile) { variableID = AssignVariableID(parameters, parameterID, variableID); runtimeVariable = LocalVariables.GetVariable(variableID, localVariables); } break; case VariableLocation.Component: Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables); if (runtimeVariables != null) { runtimeVariable = runtimeVariables.GetVariable(variableID); } runtimeVariable = AssignVariable(parameters, parameterID, runtimeVariable); break; } runtimeCompareVariable = null; switch (getVarMethod) { case GetVarMethod.GlobalVariable: compareVariableID = AssignVariableID(parameters, checkParameterID, compareVariableID); runtimeCompareVariable = GlobalVariables.GetVariable(compareVariableID, true); break; case GetVarMethod.LocalVariable: compareVariableID = AssignVariableID(parameters, checkParameterID, compareVariableID); runtimeCompareVariable = LocalVariables.GetVariable(compareVariableID, localVariables); break; case GetVarMethod.ComponentVariable: Variables runtimeCompareVariables = AssignFile <Variables> (compareVariablesConstantID, compareVariables); if (runtimeCompareVariables != null) { runtimeCompareVariable = runtimeCompareVariables.GetVariable(compareVariableID); } runtimeCompareVariable = AssignVariable(parameters, checkParameterID, runtimeCompareVariable); break; default: break; } }
override public ActionEnd End(List <AC.Action> actions) { if (_parameter == null) { return(GenerateStopActionEnd()); } GVar compareVar = null; InvItem compareItem = null; if (_parameter.parameterType == ParameterType.GlobalVariable || _parameter.parameterType == ParameterType.LocalVariable || _parameter.parameterType == ParameterType.InventoryItem) { if (compareVariableID == -1) { return(GenerateStopActionEnd()); } if (_parameter.parameterType == ParameterType.GlobalVariable) { compareVar = GlobalVariables.GetVariable(compareVariableID); compareVar.Download(); } else if (_parameter.parameterType == ParameterType.LocalVariable && !isAssetFile) { compareVar = LocalVariables.GetVariable(compareVariableID); } else if (_parameter.parameterType == ParameterType.InventoryItem) { compareItem = KickStarter.runtimeInventory.GetItem(compareVariableID); } } return(ProcessResult(CheckCondition(compareItem, compareVar), actions)); }
override public void AssignValues(List <ActionParameter> parameters) { runtimeObToRead = AssignFile(parameters, obToReadParameterID, obToReadConstantID, obToRead); runtimeVariable = null; switch (variableLocation) { case VariableLocation.Global: variableID = AssignVariableID(parameters, variableParameterID, variableID); runtimeVariable = GlobalVariables.GetVariable(variableID, true); break; case VariableLocation.Local: if (!isAssetFile) { variableID = AssignVariableID(parameters, variableParameterID, variableID); runtimeVariable = LocalVariables.GetVariable(variableID, localVariables); } break; case VariableLocation.Component: runtimeVariables = AssignFile <Variables> (variablesConstantID, variables); if (runtimeVariables != null) { runtimeVariable = runtimeVariables.GetVariable(variableID); } runtimeVariable = AssignVariable(parameters, variableParameterID, runtimeVariable); runtimeVariables = AssignVariablesComponent(parameters, variableParameterID, runtimeVariables); break; } }
override public float Run() { if (newVariableID != -1 && oldVariableID != -1) { GVar oldVar; if (oldLocation == VariableLocation.Global) { oldVar = GlobalVariables.GetVariable(oldVariableID); } else { oldVar = LocalVariables.GetVariable(oldVariableID, localVariables); } if (newLocation == VariableLocation.Local && !isAssetFile) { CopyVariable(LocalVariables.GetVariable(newVariableID, localVariables), oldVar); } else { GVar newVar = GlobalVariables.GetVariable(newVariableID); if (newVar != null) { CopyVariable(newVar, oldVar); newVar.Upload(); } } KickStarter.actionListManager.VariableChanged(); } return(0f); }
private GVar GetVariable() { GVar var = null; if (location == VariableLocation.Local && !isAssetFile) { var = LocalVariables.GetVariable(variableID); } else { if (Application.isPlaying) { var = GlobalVariables.GetVariable(variableID); } else if (AdvGame.GetReferences().variablesManager) { var = AdvGame.GetReferences().variablesManager.GetVariable(variableID); } } if (var != null && var.type == VariableType.PopUp) { return(var); } return(null); }
override public float Run() { if (newVariableID != -1 && oldVariableID != -1) { GVar oldVar; if (oldLocation == VariableLocation.Global) { oldVar = RuntimeVariables.GetVariable(oldVariableID); } else { oldVar = LocalVariables.GetVariable(oldVariableID); } if (newLocation == VariableLocation.Local && !isAssetFile) { SetVariable(LocalVariables.GetVariable(newVariableID), VariableLocation.Local, oldVar); } else { SetVariable(RuntimeVariables.GetVariable(newVariableID), VariableLocation.Global, oldVar); } } return(0f); }
protected GVar GetVariable() { GVar _var = null; switch (location) { case VariableLocation.Global: if (AdvGame.GetReferences().variablesManager) { _var = AdvGame.GetReferences().variablesManager.GetVariable(variableID); } break; case VariableLocation.Local: if (!isAssetFile) { _var = LocalVariables.GetVariable(variableID, localVariables); } break; case VariableLocation.Component: Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables); if (runtimeVariables != null) { _var = runtimeVariables.GetVariable(variableID); } break; } if (_var != null && _var.type == VariableType.PopUp) { return(_var); } return(null); }
public override void AssignValues(List <ActionParameter> parameters) { invID = AssignInvItemID(parameters, invParameterID, invID); runtimeVariable = null; switch (varLocation) { case VariableLocation.Global: variableID = AssignVariableID(parameters, varParameterID, variableID); runtimeVariable = GlobalVariables.GetVariable(variableID, true); break; case VariableLocation.Local: if (!isAssetFile) { variableID = AssignVariableID(parameters, varParameterID, variableID); runtimeVariable = LocalVariables.GetVariable(variableID, localVariables); } break; case VariableLocation.Component: Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables); if (runtimeVariables != null) { runtimeVariable = runtimeVariables.GetVariable(variableID); } runtimeVariable = AssignVariable(parameters, varParameterID, runtimeVariable); break; } }
private GVar GetVariable() { switch (location) { case VariableLocation.Global: VariablesManager variablesManager = AdvGame.GetReferences().variablesManager; if (variablesManager != null) { return(variablesManager.GetVariable(variableID)); } return(null); case VariableLocation.Local: return(LocalVariables.GetVariable(variableID)); case VariableLocation.Component: if (variables != null) { return(variables.GetVariable(variableID)); } break; } return(null); }
public bool IsTranslatable () { if (setVarMethodString == SetVarMethodString.EnteredHere && setParameterID < 0) { GVar variable = null; if (location == VariableLocation.Global) { VariablesManager variablesManager = AdvGame.GetReferences ().variablesManager; if (variablesManager != null) { variable = variablesManager.GetVariable (variableID); } } else { variable = LocalVariables.GetVariable (variableID); } if (variable != null && variable.type == VariableType.String) { return true; } } return false; }
/** * <summary>Returns the value of a local Boolean variable.</summary> * <param name = "_id">The ID number of the variable</param> * <returns>The boolean value of the variable</returns> */ public static bool GetBooleanValue(int _id) { if (LocalVariables.GetVariable(_id).val == 1) { return(true); } return(false); }
public override void AssignValues(List <ActionParameter> parameters) { if (isPlayer) { if (KickStarter.player != null) { runtimeLinkedProp = KickStarter.player.GetComponent <Moveable>(); } else { runtimeLinkedProp = null; } } else { runtimeLinkedProp = AssignFile <Moveable> (parameters, parameterID, constantID, linkedProp); } runtimeMarker = AssignFile <Marker> (parameters, markerParameterID, markerID, marker); transitionTime = AssignFloat(parameters, transitionTimeParameterID, transitionTime); newVector = AssignVector3(parameters, newVectorParameterID, newVector); if (!(transformType == TransformType.CopyMarker || (transformType == TransformType.Translate && toBy == ToBy.To) || (transformType == TransformType.Rotate && toBy == ToBy.To))) { inWorldSpace = false; } runtimeVariable = null; if (transformType != TransformType.CopyMarker && setVectorMethod == SetVectorMethod.FromVector3Variable) { switch (variableLocation) { case VariableLocation.Global: vectorVarID = AssignVariableID(parameters, vectorVarParameterID, vectorVarID); runtimeVariable = GlobalVariables.GetVariable(vectorVarID, true); break; case VariableLocation.Local: if (!isAssetFile) { vectorVarID = AssignVariableID(parameters, vectorVarParameterID, vectorVarID); runtimeVariable = LocalVariables.GetVariable(vectorVarID, localVariables); } break; case VariableLocation.Component: Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables); if (runtimeVariables != null) { runtimeVariable = runtimeVariables.GetVariable(vectorVarID); } runtimeVariable = AssignVariable(parameters, vectorVarParameterID, runtimeVariable); break; } } }
override public ActionEnd End(List <Action> actions) { if (numSockets <= 0) { ACDebug.LogWarning("Could not compute Random check because no values were possible!"); return(GenerateStopActionEnd()); } if (variableID == -1) { return(GenerateStopActionEnd()); } GVar var = null; if (location == VariableLocation.Local && !isAssetFile) { var = LocalVariables.GetVariable(variableID); } else { var = GlobalVariables.GetVariable(variableID); } if (var != null) { if (var.type == VariableType.Integer) { var.Download(); if (var.val < 1) { var.val = 1; } int originalValue = var.val - 1; var.val++; if (var.val > numSockets) { if (doLoop) { var.val = 1; } else { var.val = numSockets; } } var.Upload(); return(ProcessResult(originalValue, actions)); } else { ACDebug.LogWarning("Variable: Run sequence Action is referencing a Variable that does not exist!"); } } return(GenerateStopActionEnd()); }
override public float Run() { if (obToRead != null) { GVar variable = null; if (variableLocation == VariableLocation.Global) { variable = GlobalVariables.GetVariable(variableID); } else if (variableLocation == VariableLocation.Local && !isAssetFile) { variable = LocalVariables.GetVariable(variableID); } if (variable != null) { switch (transformRecordType) { case TransformRecordType.Position: if (transformLocation == VariableLocation.Global) { variable.SetVector3Value(obToRead.transform.position); } else if (transformLocation == VariableLocation.Local) { variable.SetVector3Value(obToRead.transform.localPosition); } break; case TransformRecordType.Rotation: if (transformLocation == VariableLocation.Global) { variable.SetVector3Value(obToRead.transform.eulerAngles); } else if (transformLocation == VariableLocation.Local) { variable.SetVector3Value(obToRead.transform.localEulerAngles); } break; case TransformRecordType.Scale: if (transformLocation == VariableLocation.Global) { variable.SetVector3Value(obToRead.transform.lossyScale); } else if (transformLocation == VariableLocation.Local) { variable.SetVector3Value(obToRead.transform.localScale); } break; } } } return(0f); }
override public void AssignValues(List <ActionParameter> parameters) { oldRuntimeVariable = null; switch (oldLocation) { case VariableLocation.Global: oldVariableID = AssignVariableID(parameters, oldParameterID, oldVariableID); oldRuntimeVariable = GlobalVariables.GetVariable(oldVariableID); break; case VariableLocation.Local: if (!isAssetFile) { oldVariableID = AssignVariableID(parameters, oldParameterID, oldVariableID); oldRuntimeVariable = LocalVariables.GetVariable(oldVariableID, localVariables); } break; case VariableLocation.Component: Variables oldRuntimeVariables = AssignFile <Variables> (oldVariablesConstantID, oldVariables); if (oldRuntimeVariables != null) { oldRuntimeVariable = oldRuntimeVariables.GetVariable(oldVariableID); } oldRuntimeVariable = AssignVariable(parameters, oldParameterID, oldRuntimeVariable); break; } newRuntimeVariable = null; switch (newLocation) { case VariableLocation.Global: newVariableID = AssignVariableID(parameters, newParameterID, newVariableID); newRuntimeVariable = GlobalVariables.GetVariable(newVariableID, true); break; case VariableLocation.Local: if (!isAssetFile) { newVariableID = AssignVariableID(parameters, newParameterID, newVariableID); newRuntimeVariable = LocalVariables.GetVariable(newVariableID, localVariables); } break; case VariableLocation.Component: newRuntimeVariables = AssignFile <Variables> (newVariablesConstantID, newVariables); if (newRuntimeVariables != null) { newRuntimeVariable = newRuntimeVariables.GetVariable(newVariableID); } newRuntimeVariable = AssignVariable(parameters, newParameterID, newRuntimeVariable); newRuntimeVariables = AssignVariablesComponent(parameters, newParameterID, newRuntimeVariables); break; } }
/** * <summary>Sets the value of a local Boolean variable.</summary> * <param name = "_id">The ID number of the variable</param> * <param name = "_value">The new bool value of the variable</param> */ public static void SetBooleanValue(int _id, bool _value) { if (_value) { LocalVariables.GetVariable(_id).val = 1; } else { LocalVariables.GetVariable(_id).val = 0; } }
override public ActionEnd End(List <Action> actions) { if (numSockets <= 0) { ACDebug.LogWarning("Could not compute Random check because no values were possible!"); return(GenerateStopActionEnd()); } GVar linkedVariable = null; if (saveToVariable) { if (location == VariableLocation.Local && !isAssetFile) { linkedVariable = LocalVariables.GetVariable(variableID); } else { linkedVariable = GlobalVariables.GetVariable(variableID); } } int randomResult = Random.Range(0, numSockets); if (numSockets > 1 && disallowSuccessive) { if (saveToVariable) { if (linkedVariable != null && linkedVariable.type == VariableType.Integer) { ownVarValue = linkedVariable.val; } else { ACDebug.LogWarning("'Variable: Check random number' Action is referencing a Variable that does not exist or is not an Integer!"); } } while (ownVarValue == randomResult) { randomResult = Random.Range(0, numSockets); } ownVarValue = randomResult; if (saveToVariable && linkedVariable != null && linkedVariable.type == VariableType.Integer) { linkedVariable.SetValue(ownVarValue); } } return(ProcessResult(randomResult, actions)); }
/** * <summary>Generates a label that represents the name of the parameter's value, if appropriate<summary> * <returns>A label that represents the name of the parameter's value<summary> */ public string GetLabel() { switch (parameterType) { case ParameterType.GameObject: if (gameObject != null) { Hotspot _hotspot = gameObject.GetComponent <Hotspot>(); if (_hotspot) { return(_hotspot.GetName(Options.GetLanguage())); } Char _char = gameObject.GetComponent <Char>(); if (_char) { return(_char.GetName(Options.GetLanguage())); } return(gameObject.name); } return(string.Empty); case ParameterType.InventoryItem: InvItem invItem = KickStarter.inventoryManager.GetItem(intValue); if (invItem != null) { return(invItem.GetLabel(Options.GetLanguage())); } return(GetSaveData()); case ParameterType.GlobalVariable: GVar gVar = KickStarter.variablesManager.GetVariable(intValue); if (gVar != null) { return(gVar.label); } return(GetSaveData()); case ParameterType.LocalVariable: GVar lVar = LocalVariables.GetVariable(intValue); if (lVar != null) { return(lVar.label); } return(GetSaveData()); default: return(GetSaveData()); } }
override public void AssignValues(List <ActionParameter> parameters) { if (invAction == InvAction.Add || invAction == InvAction.Replace) { _gameObject = AssignFile(parameters, parameterID, 0, gameObject); if (invAction == InvAction.Replace) { replaceGameObject = AssignFile(parameters, replaceParameterID, replaceConstantID, replaceGameObject); } else if (invAction == InvAction.Add) { relativeGameObject = AssignFile(parameters, relativeGameObjectParameterID, relativeGameObjectID, relativeGameObject); } } else if (invAction == InvAction.Remove) { _gameObject = AssignFile(parameters, parameterID, constantID, gameObject); } relativeVector = AssignVector3(parameters, relativeVectorParameterID, relativeVector); if (invAction == InvAction.Add && positionRelativeTo == PositionRelativeTo.VectorVariable) { runtimeVariable = null; switch (variableLocation) { case VariableLocation.Global: vectorVarID = AssignVariableID(parameters, vectorVarParameterID, vectorVarID); runtimeVariable = GlobalVariables.GetVariable(vectorVarID, true); break; case VariableLocation.Local: if (!isAssetFile) { vectorVarID = AssignVariableID(parameters, vectorVarParameterID, vectorVarID); runtimeVariable = LocalVariables.GetVariable(vectorVarID, localVariables); } break; case VariableLocation.Component: Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables); if (runtimeVariables != null) { runtimeVariable = runtimeVariables.GetVariable(vectorVarID); } runtimeVariable = AssignVariable(parameters, vectorVarParameterID, runtimeVariable); break; } } }
override public ActionEnd End(List <AC.Action> actions) { if (variableID == -1) { return(GenerateStopActionEnd()); } GVar compareVar = null; if (getVarMethod == GetVarMethod.GlobalVariable || getVarMethod == GetVarMethod.LocalVariable) { if (compareVariableID == -1) { return(GenerateStopActionEnd()); } if (getVarMethod == GetVarMethod.GlobalVariable) { compareVar = GlobalVariables.GetVariable(compareVariableID); compareVar.Download(); } else if (getVarMethod == GetVarMethod.LocalVariable && !isAssetFile) { compareVar = LocalVariables.GetVariable(compareVariableID, localVariables); } } if (location == VariableLocation.Local && !isAssetFile) { GVar localVar = LocalVariables.GetVariable(variableID, localVariables); if (localVar != null) { return(ProcessResult(CheckCondition(localVar, compareVar), actions)); } ACDebug.LogWarning("The 'Variable: Check' Action halted the ActionList because it cannot find the Local Variable with an ID of " + variableID); return(GenerateStopActionEnd()); } else { GVar var = GlobalVariables.GetVariable(variableID); if (var != null) { var.Download(); return(ProcessResult(CheckCondition(var, compareVar), actions)); } ACDebug.LogWarning("The 'Variable: Check' Action halted the ActionList because it cannot find the Global Variable with an ID of " + variableID); return(GenerateStopActionEnd()); } }
override public ActionEnd End(List <AC.Action> actions) { if (_parameter == null) { return(GenerateStopActionEnd()); } GVar compareVar = null; InvItem compareItem = null; Document compareDoc = null; if (_parameter.parameterType == ParameterType.GlobalVariable || _parameter.parameterType == ParameterType.LocalVariable || _parameter.parameterType == ParameterType.ComponentVariable || _parameter.parameterType == ParameterType.InventoryItem || _parameter.parameterType == ParameterType.Document) { if (compareVariableID == -1) { return(GenerateStopActionEnd()); } if (_parameter.parameterType == ParameterType.GlobalVariable) { compareVar = GlobalVariables.GetVariable(compareVariableID, true); } else if (_parameter.parameterType == ParameterType.LocalVariable && !isAssetFile) { compareVar = LocalVariables.GetVariable(compareVariableID); } else if (_parameter.parameterType == ParameterType.ComponentVariable) { runtimeCompareVariables = AssignFile <Variables> (compareObjectConstantID, compareVariables); if (runtimeCompareVariables != null) { compareVar = runtimeCompareVariables.GetVariable(compareVariableID); } } else if (_parameter.parameterType == ParameterType.InventoryItem) { compareItem = KickStarter.inventoryManager.GetItem(compareVariableID); } else if (_parameter.parameterType == ParameterType.Document) { compareDoc = KickStarter.inventoryManager.GetDocument(compareVariableID); } } return(ProcessResult(CheckCondition(compareItem, compareVar, compareDoc), actions)); }
override public void Skip() { if (variableID != -1) { if (location == VariableLocation.Local && !isAssetFile) { SetVariable(LocalVariables.GetVariable(variableID), VariableLocation.Local, true); } else { SetVariable(RuntimeVariables.GetVariable(variableID), VariableLocation.Global, true); } } }
override public float Run() { if (variableID != -1) { if (location == VariableLocation.Local && !isAssetFile) { SetVariable(LocalVariables.GetVariable(variableID), VariableLocation.Local, false); } else { SetVariable(RuntimeVariables.GetVariable(variableID), VariableLocation.Global, false); } } return(0f); }
private GVar GetVariable() { if (location == VariableLocation.Global) { VariablesManager variablesManager = AdvGame.GetReferences().variablesManager; if (variablesManager != null) { return(variablesManager.GetVariable(variableID)); } return(null); } else { return(LocalVariables.GetVariable(variableID)); } }
override public ActionEnd End(List <AC.Action> actions) { if (variableID == -1) { return(GenerateStopActionEnd()); } GVar compareVar = null; if (getVarMethod == GetVarMethod.GlobalVariable || getVarMethod == GetVarMethod.LocalVariable) { if (compareVariableID == -1) { return(GenerateStopActionEnd()); } if (getVarMethod == GetVarMethod.GlobalVariable) { compareVar = GlobalVariables.GetVariable(compareVariableID); compareVar.Download(); } else if (getVarMethod == GetVarMethod.LocalVariable && !isAssetFile) { compareVar = LocalVariables.GetVariable(compareVariableID); } } if (location == VariableLocation.Local && !isAssetFile) { return(ProcessResult(CheckCondition(LocalVariables.GetVariable(variableID), compareVar), actions)); } else { GVar var = GlobalVariables.GetVariable(variableID); if (var != null) { var.Download(); return(ProcessResult(CheckCondition(var, compareVar), actions)); } return(GenerateStopActionEnd()); } }
public GVar GetVariable() { switch (parameterType) { case ParameterType.GlobalVariable: return(GlobalVariables.GetVariable(intValue, true)); case ParameterType.LocalVariable: return(LocalVariables.GetVariable(intValue)); case ParameterType.ComponentVariable: if (variables != null) { return(variables.GetVariable(intValue)); } break; } return(null); }
override public void AssignValues(List <ActionParameter> parameters) { runtimeObToMove = AssignFile(parameters, obToMoveParameterID, obToMoveID, obToMove); runtimeTeleporter = AssignFile <Marker> (parameters, markerParameterID, markerID, teleporter); relativeGameObject = AssignFile(parameters, relativeGameObjectParameterID, relativeGameObjectID, relativeGameObject); relativeVector = AssignVector3(parameters, relativeVectorParameterID, relativeVector); if (isPlayer && KickStarter.player) { runtimeObToMove = KickStarter.player.gameObject; } runtimeVariable = null; if (positionRelativeTo == PositionRelativeTo.VectorVariable) { switch (variableLocation) { case VariableLocation.Global: vectorVarID = AssignVariableID(parameters, vectorVarParameterID, vectorVarID); runtimeVariable = GlobalVariables.GetVariable(vectorVarID, true); break; case VariableLocation.Local: if (!isAssetFile) { vectorVarID = AssignVariableID(parameters, vectorVarParameterID, vectorVarID); runtimeVariable = LocalVariables.GetVariable(vectorVarID, localVariables); } break; case VariableLocation.Component: Variables runtimeVariables = AssignFile <Variables> (variablesConstantID, variables); if (runtimeVariables != null) { runtimeVariable = runtimeVariables.GetVariable(vectorVarID); } runtimeVariable = AssignVariable(parameters, vectorVarParameterID, runtimeVariable); break; } } }
override public float Run() { GVar myVar = (varLocation == VariableLocation.Global) ? GlobalVariables.GetVariable(variableID) : LocalVariables.GetVariable(variableID, localVariables); InvItem invItem = (setVarAsPropertyMethod == SetVarAsPropertyMethod.SelectedItem) ? KickStarter.runtimeInventory.LastSelectedItem : KickStarter.inventoryManager.GetItem(invID); if (invItem != null && myVar != null) { InvVar invVar = invItem.GetProperty(propertyID); if (myVar.type == VariableType.String) { myVar.textVal = invVar.GetDisplayValue(Options.GetLanguage()); } else if (myVar.type == invVar.type) { if (invVar.type == VariableType.Float) { myVar.FloatValue = invVar.FloatValue; } else if (invVar.type == VariableType.Vector3) { myVar.Vector3Value = invVar.Vector3Value; } else { myVar.IntegerValue = invVar.IntegerValue; } } else { ACDebug.LogWarning("Cannot assign " + varLocation.ToString() + " Variable " + myVar.label + "'s value from '" + invVar.label + "' property because their types do not match."); } } return(0); }
private void UnloadVariablesData(string data) { if (data == null) { return; } if (data.Length > 0) { string[] varsArray = data.Split("|"[0]); foreach (string chunk in varsArray) { string[] chunkData = chunk.Split(":"[0]); int _id = 0; int.TryParse(chunkData[0], out _id); GVar var = LocalVariables.GetVariable(_id); if (var.type == VariableType.String) { string _text = chunkData[1]; var.SetValue(_text); } else if (var.type == VariableType.Float) { float _value = 0f; float.TryParse(chunkData[1], out _value); var.SetValue(_value, SetVarMethod.SetValue); } else { int _value = 0; int.TryParse(chunkData[1], out _value); var.SetValue(_value, SetVarMethod.SetValue); } } } }
/** * <summary>Selects a Variable for editing</summary> * <param name = "variableID">The ID of the Variable to select</param> * <param name = "location">The Variable's location (Global, Local)</param> */ public void ShowVariable(int variableID, VariableLocation location) { if (location == VariableLocation.Global) { GVar varToActivate = GetVariable(variableID); if (varToActivate != null) { DeactivateAllVars(); ActivateVar(varToActivate); } SetTab(0); } else if (location == VariableLocation.Local) { GVar varToActivate = LocalVariables.GetVariable(variableID); if (varToActivate != null) { DeactivateAllVars(); ActivateVar(varToActivate); } SetTab(1); } }