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 #2
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);
        }
    }