public static void OpenWindow(StateMachineController stateMachine) { StateMachineWindow window = GetWindow <StateMachineWindow>(); window.titleContent = new GUIContent("State Machine"); window.minSize = new Vector2(800, 600); window.stateMachine = stateMachine; window.serializedObject = new SerializedObject(stateMachine); window.nodesInfo = (NodesInfo)AssetDatabase.LoadAssetAtPath(AssetDatabase.GetAssetPath(stateMachine), typeof(NodesInfo)); window.transitions = new List <List <int> >(StateMachineReflections.GetTransitions(stateMachine).Select(i => i.ToList())); window.startStateIndex = StateMachineReflections.GetStartStateIndex(stateMachine); }
public State(StateMachineController stateMachine, NodesInfo nodesInfo, int stateIndex) { this.stateMachine = stateMachine; this.nodesInfo = nodesInfo; this.stateIndex = stateIndex; transitionsIndexes = StateMachineReflections.GetTransitions(stateMachine); isDurationsEnd = StateMachineReflections.GetIsDurationsEnd(stateMachine); conditions = StateMachineReflections.GetConditions(stateMachine); name = nodesInfo.Names[stateIndex]; duration = StateMachineReflections.GetDurations(stateMachine)[stateIndex]; actions = StateMachineReflections.GetActions(stateMachine)[stateIndex]; transitions = new Transition[transitionsIndexes[stateIndex].Length]; for (int i = 0; i < transitions.Length; i++) { transitions[i] = new Transition("=> " + nodesInfo.Names[transitionsIndexes[stateIndex][i]], isDurationsEnd[stateIndex][i], conditions[stateIndex][i]); } }