Exemple #1
0
        void DrawGizmosNode(QuadTreeNode <QTCircleCollider> node,
                            Color nodeColor,
                            Color objectColor,
                            float height)
        {
            Vector3 heightVector = new Vector3(0f, height, 0f);

            Gizmos.color = nodeColor;
            Gizmos.DrawWireCube(WorldConversion.ToVector3(node.bounds.center) + heightVector,
                                WorldConversion.ToVector3(node.bounds.size));

            Gizmos.color = objectColor;
            for (int i = 0; i < node.objects.Count; i++)
            {
                if (node.objects[i].obj.isEnable)
                {
                    Rect rect = node.objects[i].rect;

                    Gizmos.DrawWireCube(WorldConversion.ToVector3(rect.center) + heightVector,
                                        WorldConversion.ToVector3(rect.size));
                }
            }

            for (int i = 0; i < node.nodes.Length; i++)
            {
                if (node.nodes[i] != null)
                {
                    DrawGizmosNode(node.nodes[i],
                                   nodeColor,
                                   objectColor,
                                   height);
                }
            }

            Gizmos.color = Color.white;
        }
Exemple #2
0
 public QuadTree(Rect bounds)
 {
     _root = new QuadTreeNode <T>(0, bounds);
 }