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; FloatVar floatVar = null; if (graph_state.TryGetFloatVar(varName, out floatVar, localType)) { floatVar.value = GetInputValue <float>("inputValue", this.inputValue); } }