Exemplo n.º 1
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            if (_manager.selectedNode != null)
            {
                EditorGUILayout.LabelField("Last Status: " + _manager.selectedNode.lastStatus.ToString());
            }

            BehaviorTreeAgent btAgent = target as BehaviorTreeAgent;

            if (btAgent.context != null)
            {
                EditorGUILayout.LabelField("Current Context");
                foreach (KeyValuePair <string, object> item in btAgent.context.All)
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.LabelField(item.Key);
                    EditorGUILayout.LabelField(item.Value.ToString());
                    EditorGUILayout.EndHorizontal();
                }
            }

            if (GUILayout.Button("Show Behavior Tree editor"))
            {
                BTEditorWindow.ShowWindow();
            }
        }
Exemplo n.º 2
0
        public static void ShowWindow()
        {
            BTEditorWindow editor = EditorWindow.GetWindow <BTEditorWindow> ();

            editor.minSize = new Vector2(480, 360);
            editor.title   = "Behavior Tree";
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            if (BTEditorManager.Manager.nodeInspector == null)
            {
                EditorGUILayout.LabelField("Behavior Tree", TitleStyle);

                if (manager.behaviorTree.nodes.Count > 2)
                {
                    EditorGUILayout.LabelField(string.Format("{0} nodes", manager.behaviorTree.nodes.Count - 1));
                }
                else if (manager.behaviorTree.nodes.Count == 2)
                {
                    EditorGUILayout.LabelField("Empty");
                }
                else
                {
                    EditorGUILayout.LabelField("1 node");
                }

                EditorGUILayout.Space();

                if (GUILayout.Button("Show Behavior Tree editor"))
                {
                    BTEditorWindow.ShowWindow();
                }
            }
            else
            {
                manager.nodeInspector.OnInspectorGUI();
            }

            if (GUI.changed)
            {
                manager.Dirty();
            }
        }
Exemplo n.º 4
0
 public View(BTEditorWindow owner)
 {
     editorWindow = owner;
     canvas       = new Rect(0, 0, owner.position.width, owner.position.height);
 }
Exemplo n.º 5
0
 public View(BTEditorWindow owner)
 {
     editorWindow = owner;
     canvas = new Rect(0, 0, owner.position.width, owner.position.height);
 }