public override NodeGraph Copy() { Graph_State cp = (Graph_State)base.Copy(); int indexOfRoot = nodes.IndexOf(RootState); int indexOfCurrent = nodes.IndexOf(CurrentState); //Confirmando os nos current e root, pois por algum motivos eles perdem a referencia quando sao instanciados cp._currentState = (NodeBase_State)cp.nodes[indexOfRoot]; cp._rootState = (NodeBase_State)cp.nodes[indexOfCurrent]; //Troca a referencia dos estados que são referencia nos nós de JUMP STATE. List <Node> jumps = cp.nodes.FindAll(r => r is Node_StateJump); foreach (Node j in jumps) { Node_StateJump nj = (Node_StateJump)j; nj.goToState = (NodeBase_State)cp.nodes[nodes.IndexOf(nj.goToState)]; } //Renomeia os nos instanciados pois por algum motivo eles perdem o nome quando sao instanciado for (int i = 0; i < cp.nodes.Count; i++) { cp.nodes[i].name = nodes[i].name; } return(cp); }
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; IntVar intvar = null; if (graph_state.TryGetIntVar(varName, out intvar, localType)) { intvar.value = GetInputValue <int>("inputValue", this.inputValue); } }
protected virtual void OnGraphChangeInEditor(Graph_State old, Graph_State newg) { }
public List <string> GeVariableNames() { Graph_State graph_state = (Graph_State)graph; return(graph_state.GetVariablesName(GraphVarType.Integer, localType)); }
public override List <string> GetVariableNames() { Graph_State graphState = (Graph_State)graph; return(graphState.GetVariablesName(GetGraphVarType(), LocalType)); }