Example #1
0
        /// <summary>
        /// Crée une nouvelle <see cref="Region"/> vide.
        /// </summary>
        /// <param name="topLeft">Limite haut gauche.</param>
        /// <param name="bottomRight">Limite bas droite.</param>
        public Region(Vector2 topLeft, Vector2 bottomRight)
        {
            if (topLeft.x > bottomRight.x || topLeft.y < bottomRight.y)
            {
                throw new ArgumentException("Unable to create region : top left limit is below or to the right of the bottom right limit.");
            }

            nodeCount  = 0;
            nodes      = new Node[MaxNodeCount];
            subregions = new Region[NbSubregions];

            this.topLeft     = topLeft;
            this.bottomRight = bottomRight;
            size             = new Vector2(bottomRight.x - topLeft.x, topLeft.y - bottomRight.y);
            center           = new Vector2(bottomRight.x - size.x / 2, topLeft.y - size.y / 2);

            reusableNodeList = new ReusableList <Node>();
        }