diff --git a/AirBomber/AirBomber/FormMap.Designer.cs b/AirBomber/AirBomber/FormMap.Designer.cs
index 61a199a..54ebe8b 100644
--- a/AirBomber/AirBomber/FormMap.Designer.cs
+++ b/AirBomber/AirBomber/FormMap.Designer.cs
@@ -158,7 +158,8 @@
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxSelectorMap.FormattingEnabled = true;
this.comboBoxSelectorMap.Items.AddRange(new object[] {
- "Простая карта"});
+ "Простая карта",
+ "Карта со стенами"});
this.comboBoxSelectorMap.Location = new System.Drawing.Point(12, 12);
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
this.comboBoxSelectorMap.Size = new System.Drawing.Size(121, 23);
diff --git a/AirBomber/AirBomber/FormMap.cs b/AirBomber/AirBomber/FormMap.cs
index 159d4c6..c311927 100644
--- a/AirBomber/AirBomber/FormMap.cs
+++ b/AirBomber/AirBomber/FormMap.cs
@@ -87,6 +87,9 @@ namespace AirBomber
case "Простая карта":
_abstractMap = new SimpleMap();
break;
+ case "Карта со стенами":
+ _abstractMap = new WallMap();
+ break;
}
}
}
diff --git a/AirBomber/AirBomber/WallMap.cs b/AirBomber/AirBomber/WallMap.cs
new file mode 100644
index 0000000..8cb7989
--- /dev/null
+++ b/AirBomber/AirBomber/WallMap.cs
@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace AirBomber
+{
+ internal class WallMap : AbstractMap
+ {
+ ///
+ /// Цвет участка закрытого
+ ///
+ private readonly Brush barrierColor = new SolidBrush(Color.Brown);
+ ///
+ /// Цвет участка открытого
+ ///
+ private readonly Brush roadColor = new SolidBrush(Color.LightPink);
+ protected override void DrawBarrierPart(Graphics g, int i, int j)
+ {
+ g.FillPolygon(barrierColor, new PointF[]
+ {
+ new PointF(i * _size_x, j * _size_y),
+ new PointF((i + 1) * _size_x, j * _size_y),
+ new PointF((i + 1) * _size_x - _size_x / 4, (j + 1) * _size_y - _size_y / 2),
+ new PointF((i + 1) * _size_x, (j + 1) * _size_y),
+ new PointF(i * _size_x, (j + 1) * _size_y),
+ new PointF(i * _size_x + _size_x / 4, (j + 1) * _size_y - _size_y / 2),
+ });
+ }
+
+ protected override void DrawRoadPart(Graphics g, int i, int j)
+ {
+ g.FillRectangle(roadColor, i * _size_x, j * _size_y, (i + 1) * _size_x, (j + 1) * _size_y);
+ }
+
+ protected override void GenerateMap()
+ {
+ _map = new int[120, 120];
+ var minSize = Math.Min(_map.GetLength(0), _map.GetLength(1));
+ _size_x = (float)_width / _map.GetLength(0);
+ _size_y = (float)_height / _map.GetLength(1);
+ for (int i = 0; i < _map.GetLength(0); ++i)
+ {
+ for (int j = 0; j < _map.GetLength(1); ++j)
+ {
+ _map[i, j] = _freeRoad;
+ }
+ }
+ for (var i = 0; i < 10; i++)
+ {
+ var lengthWall = _random.Next(3, minSize / 2);
+ var incX = _random.Next(0, 2);
+ var incY = 1 - incX;
+ var left = _random.Next(0, _map.GetLength(0) - lengthWall);
+ var top = _random.Next(0, _map.GetLength(1) - lengthWall);
+ for (var j = 0; j < lengthWall; j++)
+ {
+ _map[left + incX * j, top + incY * j] = _barrier;
+ }
+ }
+
+ }
+ }
+}