bool SetLeafToChildren(QuadtreeLeafUpdate <T> leaf)
        {
            Debug.Log("位置在" + _field.top + "," + _field.right + "," + _field.bottom + "," + _field.left + "的树枝节点向子节点存入位置在" + leaf.position + "半径是" + leaf.radius + "的叶子");

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

            Debug.LogError("向位置在" + _field.top + "," + _field.right + "," + _field.bottom + "," + _field.left + "的节点存入叶子时发生错误:叶子不在所有子节点的范围里。"); //Debug.LogError:在Console面板输出Error,就是红色那种消息
            return(false);
        }
Пример #2
0
 public static bool SetLeaf(QuadtreeLeafUpdate <GameObject> leaf)
 {
     return(_quadtree.SetLeaf(leaf));
 }
 void ResetLeaf(QuadtreeLeafUpdate <T> leaf)
 {
     Debug.Log("位置在" + _field.top + "," + _field.right + "," + _field.bottom + "," + _field.left + "的树梢节点移除位置在" + leaf.position + "半径是" + leaf.radius + "的叶子,重新存入树");
     RemoveLeafFromSelf(leaf);
     _root.SetLeaf(leaf);
 }