Пример #1
0
    bool RemoveLeafFromChildren(QuadtreeWithRadiusLeaf <T> leaf)
    {
        Debug.Log("位置在((" + _field.top + "," + _field.right + "," + _field.bottom + "," + _field.left + "))的树枝节点从子节点移除位置在" + leaf.position + "半径是" + leaf.radius + "的叶子");

        if (_upperRightChild._field.Contains(leaf.position))
        {
            return(_upperRightChild.RemoveLeaf(leaf));
        }
        if (_lowerRightChild._field.Contains(leaf.position))
        {
            return(_lowerRightChild.RemoveLeaf(leaf));
        }
        if (_lowerLeftChild._field.Contains(leaf.position))
        {
            return(_lowerLeftChild.RemoveLeaf(leaf));
        }
        if (_upperLeftChild._field.Contains(leaf.position))
        {
            return(_upperLeftChild.RemoveLeaf(leaf));
        }

        Debug.LogError("位置在(" + _field.top + "," + _field.right + "," + _field.bottom + "," + _field.left + ")的节点,移除叶子失败,叶子不在任何一个子节点的区域里");
        return(false);
    }
Пример #2
0
 public static void RemoveLeaf(QuadtreeWithRadiusLeaf <GameObject> leaf)
 {
     _quadtree.RemoveLeaf(leaf);
 }