Ejemplo n.º 1
0
        public static void OpenEditor()
        {
            BehaviourTreeWindow window = GetWindow <BehaviourTreeWindow>();

            window.titleContent = new GUIContent(
                "Behaviour Tree",
                Resources.Load("mbt_window_icon", typeof(Texture2D)) as Texture2D
                );
        }
Ejemplo n.º 2
0
        public override void OnInspectorGUI()
        {
            // Destroy previous editor
            if (nodeEditor != null)
            {
                DestroyImmediate(nodeEditor);
            }

            InitStyle();

            DrawDefaultInspector();
            GUILayout.Space(5);

            if (GUILayout.Button("Open editor"))
            {
                BehaviourTreeWindow.OpenEditor();
            }

            EditorGUILayout.Space();

            MonoBehaviourTree mbt    = ((MonoBehaviourTree)target);
            bool renderNodeInspector = mbt.selectedEditorNode != null;

            EditorGUILayout.BeginFoldoutHeaderGroup(renderNodeInspector, "Node inspector", foldStyle);
            EditorGUILayout.Space(1);
            if (renderNodeInspector)
            {
                EditorGUILayout.BeginHorizontal(boxStyle);
                GUILayout.Space(3);
                EditorGUILayout.BeginVertical();
                GUILayout.Space(5);
                nodeEditor = Editor.CreateEditor(mbt.selectedEditorNode);
                nodeEditor.OnInspectorGUI();
                GUILayout.Space(5);
                EditorGUILayout.EndVertical();
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndFoldoutHeaderGroup();
            EditorGUILayout.Space();
        }