Beispiel #1
0
        /// <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();
        }
Beispiel #2
0
 public void Update()
 {
     if (IsNeedRemoveChildren())
     {
         RemoveChildren();
         if (parent != null)
         {
             parent.Update();
         }
     }
 }