private void SetNodePosition(BtNode parent) { BtHelper.AutoAlignPosition(parent); if (parent.IsHaveChild) { foreach (var node in parent.ChildNodeList) { SetNodePosition(node); } } }
public BehaviourTree(string name, BtNodeData data = null) { Name = name; NodeDict = new Dictionary <string, BtNode>(); NodePosDict = new Dictionary <string, int>(); BrokenNodeDict = new Dictionary <string, BtNode>(); if (data == null) { data = new BtNodeData(BtConst.RootName, null, (BtEditorWindow.Window.position.width - BtConst.RightInspectWidth) / 2, 50); data.AddData("restart", "1"); } Root = new BtNode(this, null, data); AddNode(Root); BtHelper.AutoAlignPosition(Root); }