public virtual T GetVariableValue() { T result = default(T); Graph_State graphState = (Graph_State)graph; if (string.IsNullOrEmpty(variableName) || variableName == FSMGUtility.StringTag_Undefined) { return(result); } if (Application.isEditor && Application.isPlaying == false && localType == GraphVarLocalType.Local) { return(result); } switch (GetGraphVarType()) { case GraphVarType.Boolean: BoolVar boolVar = null; if (graphState.TryGetBoolVar(variableName, out boolVar, localType)) { result = (T)Convert.ChangeType(boolVar.value, typeof(T)); } break; case GraphVarType.Double: DoubleVar doubleVar = null; if (graphState.TryGetDoubeVar(variableName, out doubleVar, localType)) { result = (T)Convert.ChangeType(doubleVar.value, typeof(T)); } break; case GraphVarType.Float: FloatVar floatVar = null; if (graphState.TryGetFloatVar(variableName, out floatVar, localType)) { result = (T)Convert.ChangeType(floatVar.value, typeof(T)); } break; case GraphVarType.Integer: IntVar intVar = null; if (graphState.TryGetIntVar(variableName, out intVar, localType)) { result = (T)Convert.ChangeType(intVar.value, typeof(T)); } break; } return(result); }
public override void Execute(FSMBehaviour fsm) { if (Application.isEditor && Application.isPlaying == false) { return; } Graph_State graph_state = (Graph_State)graph; DoubleVar doubleVar = null; if (graph_state.TryGetDoubeVar(varName, out doubleVar, localType)) { doubleVar.value = GetInputValue <double>("inputValue", this.inputValue); } }
public bool TryGetDoubeVar(string varName, out DoubleVar doubleVar, GraphVarLocalType localType) { bool result = false; switch (localType) { case GraphVarLocalType.Local: result = last_fsm_executed.TryGetDoubeValue(varName, out doubleVar); break; case GraphVarLocalType.Global: result = settings.TryGetDoubeVar(varName, out doubleVar); break; default: doubleVar = null; break; } return(result); }
public bool TryGetDoubeVar(string variable, out DoubleVar doubleVar) { return(doubleVars.TryGetValue(variable, out doubleVar)); }