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(); } }
public static void ShowWindow() { BTEditorWindow editor = EditorWindow.GetWindow <BTEditorWindow> (); editor.minSize = new Vector2(480, 360); editor.title = "Behavior Tree"; }
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(); } }
public View(BTEditorWindow owner) { editorWindow = owner; canvas = new Rect(0, 0, owner.position.width, owner.position.height); }