private void HighlightIntersection(IEnumerable<Tile> tiles, FloatRectangle bounds)
        {
            IList<Square> squares = new List<Square>();

            foreach (Tile tile in tiles)
            {
                Rectangle intersection = (Rectangle)FloatRectangle.Intersect(bounds, tile.Bounds);
                bool intersects = intersection.Width > 0 && intersection.Height > 0;
                if (!intersects)
                {
                    continue;
                }

                Square square = new Square
                {
                    Alpha = 1f,
                    Bounds = intersection,
                    Color = Color.DarkRed
                };
                squares.Add(square);
            }

            intersectionGrid = new SquareGrid(squares);
        }
 private void HighlightMovement(FloatRectangle bounds)
 {
     movementGrid = new SquareGrid(new List<Square>
     {
         new Square
         {
             Alpha = 1f,
             Color = Color.Yellow,
             Bounds = (Rectangle)bounds
         }
     });
 }
        protected override IList<Tile> GetIntersection(FloatRectangle bounds)
        {
            IList<Tile> tiles = base.GetIntersection(bounds);

            movementGrid = null;
            matchGrid = null;
            intersectionGrid = null;

            if (Config.Diagnostic)
            {
                HighlightMovement(bounds);
                HighlightMatchingTiles(tiles, bounds);
                HighlightIntersection(tiles, bounds);
            }
            return tiles;
        }
        private void HighlightMatchingTiles(IEnumerable<Tile> tiles, FloatRectangle bounds)
        {
            IList<Square> squares = new List<Square>();

            foreach (Tile tile in tiles)
            {
                FloatRectangle intersection = (Rectangle)FloatRectangle.Intersect(bounds, tile.Bounds);
                bool intersects = intersection.Width > 0 && intersection.Height > 0;

                Square square = new Square
                {
                    Alpha = 0.7f,
                    Bounds = tile.Bounds,
                    Color = intersects ? Color.MediumPurple : Color.MintCream
                };
                squares.Add(square);
            }

            matchGrid = new SquareGrid(squares);
        }