コード例 #1
0
ファイル: PFQuadNode.cs プロジェクト: hafewa/Pathfinder
        /// <summary>
        ///	更新节点
        /// </summary>
        public void Update()
        {
            if (parent == null)
            {
                return;
            }
            if (CheckState(parent) == PFQuadNodeState.In)
            {
                if (parent.children == null)
                {
                    return;
                }
                int index;
                index = point.x <= (parent.rect.x + parent.rect.x1) / 2 ? 0 : 1;
                index = point.y <= (parent.rect.y + parent.rect.y1) / 2 ? index : index + 2;
                if (CheckState(parent.children[index]) != PFQuadNodeState.In)
                {
                    return;
                }
            }
            PFQuadTree tempParent = parent;

            parent.RemoveQuadNode(this);
            tempParent.root.AddQuadNode(this);
            tempParent.Update();
        }
コード例 #2
0
ファイル: PFQuadTree.cs プロジェクト: hafewa/Pathfinder
 public void Update()
 {
     if (IsNeedRemoveChildren())
     {
         RemoveChildren();
         if (parent != null)
         {
             parent.Update();
         }
     }
 }