override public float Run() { RuntimeVariables runtimeVariables = GameObject.FindWithTag(Tags.persistentEngine).GetComponent <RuntimeVariables>(); if (runtimeVariables) { if (variableID != -1 && runtimeVariables.localVars.Count > 0) { if (runtimeVariables.GetVarType(variableID) == VariableType.Integer) { runtimeVariables.SetValue(variableID, intValue, isCumulative); } else { runtimeVariables.SetValue(variableID, (int)boolValue, false); } } } return(0f); }
private void AssignVariables(RuntimeVariables runtimeVariables, string variablesData) { if (runtimeVariables) { if (variablesData.Length > 0) { string[] varsArray = variablesData.Split("|"[0]); foreach (string chunk in varsArray) { string[] chunkData = chunk.Split(":"[0]); int _id = 0; int.TryParse(chunkData[0], out _id); int _value = 0; int.TryParse(chunkData[1], out _value); runtimeVariables.SetValue(_id, _value, false); } } } }