コード例 #1
0
ファイル: BTNode.cs プロジェクト: yh821/BehaviorTree
 private void SetNodePosition(BtNode parent)
 {
     BtHelper.AutoAlignPosition(parent);
     if (parent.IsHaveChild)
     {
         foreach (var node in parent.ChildNodeList)
         {
             SetNodePosition(node);
         }
     }
 }
コード例 #2
0
ファイル: BehaviorTree.cs プロジェクト: yh821/BehaviorTree
        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);
        }