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; BTNodeDict = new Dictionary <string, BTNode> (); OrphanNodeDict = new Dictionary <string, BTNode> (); if (data == null) { data = new BTNodeData(BTConst.RootName, null, (BTEditorWindow.window.position.width - BTConst.RIGHT_INSPECT_WIDTH) / 2, 50); data.AddData("restart", "1"); } Root = new BTNode(this, null, data); AddNode(Root); BTHelper.AutoAlignPosition(Root); }