public static void Init(FSMEditor FSMEditor)
    {
        if (window)
        {
            window.Close();
        }

        window             = EditorWindow.GetWindow <FSMCreateStateWindow>();
        window.MyFSMEditor = FSMEditor;
        window.Start();
    }
Exemple #2
0
    public static void Init(FSM currentFSMEdited)
    {
        if (window)
        {
            window.Close();
        }

        window       = EditorWindow.GetWindow <FSMEditor>();
        window.MyFSM = currentFSMEdited;
        window.Start();
    }
    public override void OnInspectorGUI()
    {
        var fsm = (FSM)target;

        if (fsm.CurrentState)
        {
            GUILayout.Label("Current State:" + fsm.CurrentState.StateName);
        }

        if (GUILayout.Button("Launch FSM Editor"))
        {
            FSMEditor.Init(fsm);
        }
    }
Exemple #4
0
    bool ValidateIntegrity()
    {
        if (EditorStates == null || FSMCreateStateControl == null || FSMStatesControl == null)
        {
            if (this.MyFSM != null)
            {
                FSMEditor.Init(this.MyFSM);
            }
            else
            {
                this.Close();
            }

            return(false);
        }
        return(true);
    }
    void CreateState(string scriptName)
    {
        GameObject newStateGameObject = new GameObject(stateName);

        try
        {
            var component = newStateGameObject.AddComponent(scriptName);
            if (component == null)
            {
                throw new Exception("Type " + scriptName + " not found");
            }

            component.transform.parent = MyFSMEditor.MyFSM.transform;
            isScriptCompiling          = false;

            Debug.Log("State created");
            FSMEditor.Init(MyFSMEditor.MyFSM);
            this.Close();
        }
        catch (Exception ex)
        {
            Debug.Log(ex.Message);
        }
    }
Exemple #6
0
    private static void OpenWindow()
    {
        FSMEditor window = GetWindow <FSMEditor>();

        window.titleContent = new GUIContent("FSM Editor", "A visual editor for creating Finite State Machines");
    }
Exemple #7
0
 public FSMCreateStateControl(FSMEditor MyFSMEditor)
 {
     this.MyFSMEditor = MyFSMEditor;
 }
 public FSMStatesControl(FSMEditor MyFSMEditor)
 {
     this.MyFSMEditor    = MyFSMEditor;
     FSMDragStateControl = new FSMDragStateControl(this);
 }