/// <summary> /// Adds new behaviour tree to this blackboard. /// </summary> /// <param name="tree">New behaviour tree for current blackboard.</param> /// <returns>True if new tree was added. Otherwise false.</returns> public bool AddTree(AiTree tree) { if (_trees.Contains(tree)) { return false; } _trees.Add(tree); return true; }
/// <summary> /// Adds new behaviour tree to this blackboard. /// </summary> /// <param name="tree">New behaviour tree for current blackboard.</param> /// <returns>True if new tree was added. Otherwise false.</returns> public bool AddTree(AiTree tree) { if (_trees.Contains(tree)) { return(false); } _trees.Add(tree); return(true); }
public void RebuildTreeView(AiTree tree) { _tree = tree; if (_tree == null) { return; } if(_nodeDrawers != null) { foreach(NodeDrawer drawer in _nodeDrawers) { drawer.Node.OnDebugResult -= DebugResult; } } _nodeDrawers = new List<NodeDrawer>(); for (int i = 0; i < _tree.Nodes.Count; ++i) { _tree.Nodes[i].OnDebugResult += DebugResult; _nodeDrawers.Add(new NodeDrawer(_tree.Nodes[i], _tree.Root == _tree.Nodes[i])); } }
/// <summary> /// Removes behaviour tree from this blackboard. /// </summary> /// <param name="tree">Tree to remove from current blackboard.</param> /// <returns>True if tree was removed. Otherwise false.</returns> public bool RemoveTree(AiTree tree) { return(_trees.Remove(tree)); }
public TreeDrawer(AiTree tree) { NodeDrawer.OnLeftClicked += NodeLeftClicked; NodeDrawer.OnRightClicked += ShowContextMenu; RebuildTreeView(tree); }
/// <summary> /// Removes behaviour tree from this blackboard. /// </summary> /// <param name="tree">Tree to remove from current blackboard.</param> /// <returns>True if tree was removed. Otherwise false.</returns> public bool RemoveTree(AiTree tree) { return _trees.Remove(tree); }