Пример #1
0
        bool SetLeafToChildren(QuadtreeLeafRadius <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);
        }
 public static void SetLeaf(QuadtreeLeafRadius <GameObject> leaf)
 {
     _quadtree.SetLeaf(leaf);
 }