Exemple #1
0
        private void DrawDiagnosticTileGrid(SpriteBatch spriteBatch)
        {
            if (diagnosticTextureGrid == null)
            {
                IList <Square> squares = new List <Square>();
                TileMatrix     matrix  = TileMatrix.Instance;

                int w = Tile.Width - 1;
                int h = Tile.Height - 1;

                foreach (Tile tile in matrix.Tiles)
                {
                    int x = tile.Position.X + 1;
                    int y = tile.Position.Y + 1;

                    Square square = new Square
                    {
                        Alpha  = 0.65f,
                        Color  = tile.Impassable ? Color.IndianRed : Color.LimeGreen,
                        Bounds = new Rectangle(x, y, w, h)
                    };
                    squares.Add(square);
                }
                diagnosticTextureGrid = new FragmentedSquareGrid(squares);
            }

            spriteBatch.Begin();
            diagnosticTextureGrid.Draw(spriteBatch);
            spriteBatch.End();
        }
Exemple #2
0
        private void DrawDiagnosticTileGrid(SpriteBatch spriteBatch)
        {
            if (diagnosticTextureGrid == null)
            {
                IList<Square> squares = new List<Square>();
                TileMatrix matrix = TileMatrix.Instance;

                int w = Tile.Width - 1;
                int h = Tile.Height - 1;

                foreach (Tile tile in matrix.Tiles)
                {
                    int x = tile.Position.X + 1;
                    int y = tile.Position.Y + 1;

                    Square square = new Square
                    {
                        Alpha = 0.65f,
                        Color = tile.Impassable ? Color.IndianRed : Color.LimeGreen,
                        Bounds = new Rectangle(x, y, w, h)
                    };
                    squares.Add(square);
                }
                diagnosticTextureGrid = new FragmentedSquareGrid(squares);
            }

            spriteBatch.Begin();
            diagnosticTextureGrid.Draw(spriteBatch);
            spriteBatch.End();
        }