Пример #1
0
        private static void DrawTile(Graphics2D g, Tile tile)
        {
            if (TileDebugInfoMode == TileDrawInfo.CollisionBoxes) {
                if (tile.IsSolid && tile.CollisionModel != null) {
                    foreach (Rectangle2F box in tile.CollisionModel.Boxes) {
                        Rectangle2F r = Rectangle2F.Translate(box, tile.Position);
                        g.FillRectangle(r, Color.Red);
                        //g.DrawRectangle(r, 1, Color.Maroon);
                    }
                }
            }
            else if (TileDebugInfoMode == TileDrawInfo.GridArea) {
                Rectangle2F tileBounds = (Rectangle2F) tile.TileGridArea;
                tileBounds.Point *= GameSettings.TILE_SIZE;
                tileBounds.Size *= GameSettings.TILE_SIZE;
                Color c = Color.Yellow;
                if (tile.Layer == 1)
                    c = Color.Blue;
                else if (tile.Layer == 2)
                    c = Color.Red;
                g.FillRectangle(tileBounds, c);

                tileBounds = new Rectangle2F(tile.Position, tile.Size * GameSettings.TILE_SIZE);
                c = Color.Olive;
                if (tile.Layer == 1)
                    c = Color.Cyan;
                else if (tile.Layer == 2)
                    c = Color.Maroon;

                g.DrawLine(new Line2F(tileBounds.TopLeft, tileBounds.BottomRight - new Point2I(1, 1)), 1, c);
                g.DrawLine(new Line2F(tileBounds.TopRight - new Point2I(1, 0), tileBounds.BottomLeft - new Point2I(0, 1)), 1, c);
                g.DrawRectangle(tileBounds, 1, Color.Black);
            }
        }