protected override void OnNodeInspectorGUI() { EditorUtils.BBParameterField("Behaviour SubTree", _subTree); if (subTree == this.graph){ Debug.LogWarning("You can't have a Graph nested to iteself! Please select another"); subTree = null; } if (subTree != null){ var defParams = subTree.GetDefinedParameters(); if (defParams.Length != 0){ EditorUtils.TitledSeparator("Defined SubTree Parameters"); GUI.color = Color.yellow; UnityEditor.EditorGUILayout.LabelField("Name", "Type"); GUI.color = Color.white; var added = new List<string>(); foreach(var bbVar in defParams){ if (!added.Contains(bbVar.name)){ UnityEditor.EditorGUILayout.LabelField(bbVar.name, bbVar.varType.FriendlyName()); added.Add(bbVar.name); } } if (GUILayout.Button("Check/Create Blackboard Variables")){ subTree.CreateDefinedParameterVariables(graphBlackboard); } } } }
bool IsInstance(BehaviourTree bt) { return instances.Values.Contains(bt); }
void CheckInstance() { if (IsInstance(subTree)){ return; } BehaviourTree instance = null; if (!instances.TryGetValue(subTree, out instance)){ instance = Graph.Clone<BehaviourTree>(subTree); instances[subTree] = instance; for (var i = 0; i < instance.allNodes.Count; i++){ instance.allNodes[i].OnGraphStarted(); } } instance.agent = graphAgent; instance.blackboard = graphBlackboard; instance.UpdateReferences(); subTree = instance; }
bool IsInstance(BehaviourTree bt) { //return instances.Values.Contains(bt); return(bt != null); }
bool IsInstance(BehaviourTree bt) { return(instances.Values.Contains(bt)); }
void CheckInstance() { if (instances.Values.Contains(subTree)) return; if (!instances.ContainsKey(subTree)) instances[subTree] = ( subTree = Graph.Clone<BehaviourTree>(subTree) ); }