AStarCollisionMap.QuadTree.Quad.Quad C# (CSharp) Method

Quad() public method

public Quad ( QuadRoot tree, Quad parent, Rectangle rectangle ) : System
tree QuadRoot
parent Quad
rectangle Microsoft.Xna.Framework.Rectangle
return System
        public Quad(QuadRoot tree, Quad parent, Rectangle rectangle)
        {
            this.tree = tree;
            this.parent = parent;
            this.rectangle = rectangle;

            this.imageX = this.rectangle.X / this.rectangle.Width;
            this.imageY = this.rectangle.Y / this.rectangle.Height;

            // Console.Out.WriteLine("Creating quad with " + this.rectangle + " this.GetDepth() = " + this.GetDepth() + ", maxDepth = " + tree.depth);
            if (this.GetDepth() == tree.depth)
            {
                this.isLeaf = true;
                tree.leafList.AddLast(this);

                if (tree.collisionMap.game != null)
                {

                    if (!tree.collisionMap.drawMode)
                    {
                        this.collisionTexture = new CollisionTexture(this, tree.collisionMap.game.Content.Load<Texture2D>
                        (tree.collisionMap.collisionMapPath + "/" + tree.collisionMap.collisionMapName + "_" + imageX + "_" + imageY));
                    }
                    else this.collisionTexture = new CollisionTexture(this, new Texture2D(tree.collisionMap.graphicsDevice,
                            this.rectangle.Width, this.rectangle.Height));
                }
                else
                {
                    this.collisionTexture = new CollisionTexture(this, new Texture2D(tree.collisionMap.graphicsDevice,
                        this.rectangle.Width, this.rectangle.Height));
                }
            }
        }