Merge pull request 'Borschevskaya A.A. Lab Work 2' (#2) from lab2 into lab1
Reviewed-on: http://student.git.athene.tech/pgirl1/PIbd-23_Borschevskaya_A.A._ArmoredCar_Base/pulls/2
This commit is contained in:
commit
0ece5c1cb5
197
ArmoredCar/ArmoredCar/AbstractMap.cs
Normal file
197
ArmoredCar/ArmoredCar/AbstractMap.cs
Normal file
@ -0,0 +1,197 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
internal abstract class AbstractMap
|
||||
{
|
||||
private IDrawningObject _drawningObject = null;
|
||||
protected int[,] _map = null;
|
||||
protected int _width;
|
||||
protected int _height;
|
||||
protected float _size_x;
|
||||
protected float _size_y;
|
||||
protected readonly Random _random = new();
|
||||
protected readonly int _freeRoad = 0;
|
||||
protected readonly int _barrier = 1;
|
||||
public Bitmap CreateMap(int width, int height, IDrawningObject drawningObject)
|
||||
{
|
||||
_width = width;
|
||||
_height = height;
|
||||
_drawningObject = drawningObject;
|
||||
GenerateMap();
|
||||
while (!SetObjectOnMap())
|
||||
{
|
||||
GenerateMap();
|
||||
}
|
||||
return DrawMapWithObject();
|
||||
}
|
||||
public Bitmap MoveObject(Direction direction)
|
||||
{
|
||||
bool flag = true;
|
||||
float step = _drawningObject.Step;
|
||||
(float left, float right, float top, float bottom) = _drawningObject.GetCurrentPosition();
|
||||
|
||||
int x1_obj_next = (int)((left - step) / _size_x);
|
||||
int y1_obj_next = (int)((top - step) / _size_y);
|
||||
int x2_obj_next = (int)((right + step) / _size_x);
|
||||
int y2_obj_next = (int)((bottom + step) / _size_y);
|
||||
|
||||
int x1_obj_current = (int)(left / _size_x);
|
||||
int y1_obj_current = (int)(top / _size_y);
|
||||
int x2_obj_current = (int)(right / _size_x);
|
||||
int y2_obj_current = (int)(bottom / _size_y);
|
||||
|
||||
// Проверка возможности перемещения
|
||||
switch (direction)
|
||||
{
|
||||
case Direction.Left:
|
||||
{
|
||||
if (x1_obj_next < 0)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = x1_obj_next; i <= x1_obj_current; i++)
|
||||
{
|
||||
for (int j = y1_obj_current; j <= y2_obj_current; j++)
|
||||
{
|
||||
if (_map[i, j] == _barrier)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Direction.Right:
|
||||
{
|
||||
if (x2_obj_next >= _map.GetLength(0))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = x2_obj_current; i <= x2_obj_next; i++)
|
||||
{
|
||||
for (int j = y1_obj_current; j <= y2_obj_current; j++)
|
||||
{
|
||||
if (_map[i, j] == _barrier)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Direction.Up:
|
||||
{
|
||||
if (y1_obj_next < 0)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = x1_obj_current; i <= x2_obj_current; i++)
|
||||
{
|
||||
for (int j = y1_obj_next; j <= y1_obj_current; j++)
|
||||
{
|
||||
if (_map[i, j] == _barrier)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case Direction.Down:
|
||||
{
|
||||
if (y2_obj_next >= _map.GetLength(0))
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = x1_obj_current; i <= x2_obj_current; i++)
|
||||
{
|
||||
for (int j = y2_obj_current; j <= y2_obj_next; j++)
|
||||
{
|
||||
if (_map[i, j] == _barrier)
|
||||
{
|
||||
flag = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (flag)
|
||||
{
|
||||
_drawningObject.MoveObject(direction);
|
||||
}
|
||||
return DrawMapWithObject();
|
||||
}
|
||||
private bool SetObjectOnMap()
|
||||
{
|
||||
if (_drawningObject == null || _map == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int x = _random.Next(0, 10);
|
||||
int y = _random.Next(0, 10);
|
||||
_drawningObject.SetObject(x, y, _width, _height);
|
||||
(float left, float right, float top, float bottom) = _drawningObject.GetCurrentPosition();
|
||||
for (int i = (int)(x / _size_x); i <= (int) (right / _size_x); i++)
|
||||
{
|
||||
for (int j = (int)(y / _size_y); j <= (int) (bottom / _size_y); j++)
|
||||
{
|
||||
if (_map[i, j] == _barrier)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
private Bitmap DrawMapWithObject()
|
||||
{
|
||||
Bitmap bmp = new(_width, _height);
|
||||
if (_drawningObject == null || _map == null)
|
||||
{
|
||||
return bmp;
|
||||
}
|
||||
Graphics gr = Graphics.FromImage(bmp);
|
||||
|
||||
for (int i = 0; i < _map.GetLength(0); ++i)
|
||||
{
|
||||
for (int j = 0; j < _map.GetLength(1); ++j)
|
||||
{
|
||||
if (_map[i, j] == _freeRoad)
|
||||
{
|
||||
DrawRoadPart(gr, i, j);
|
||||
}
|
||||
else if (_map[i, j] == _barrier)
|
||||
{
|
||||
DrawBarrierPart(gr, i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_drawningObject.DrawningObject(gr);
|
||||
return bmp;
|
||||
}
|
||||
protected abstract void GenerateMap();
|
||||
protected abstract void DrawRoadPart(Graphics g, int i, int j);
|
||||
protected abstract void DrawBarrierPart(Graphics g, int i, int j);
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ namespace ArmoredCar
|
||||
{
|
||||
enum Direction
|
||||
{
|
||||
None = 0,
|
||||
Up = 1,
|
||||
Down = 2,
|
||||
Left = 3,
|
||||
|
@ -12,15 +12,15 @@ namespace ArmoredCar
|
||||
/// <summary>
|
||||
/// Класс-сущность
|
||||
/// </summary>
|
||||
public EntityArmoredCar ArmoredCar { private set; get; }
|
||||
public EntityArmoredCar ArmoredCar { protected set; get; }
|
||||
/// <summary>
|
||||
/// Левая координата отрисовки бронированной машины
|
||||
/// </summary>
|
||||
private float _startPosX;
|
||||
protected float _startPosX;
|
||||
/// <summary>
|
||||
/// Верхняя кооридната отрисовки бронированной машины
|
||||
/// </summary>
|
||||
private float _startPosY;
|
||||
protected float _startPosY;
|
||||
/// <summary>
|
||||
/// Ширина окна отрисовки
|
||||
/// </summary>
|
||||
@ -43,11 +43,18 @@ namespace ArmoredCar
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес бронированной машины</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public DrawningArmoredCar(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
ArmoredCar = new EntityArmoredCar();
|
||||
ArmoredCar.Init(speed, weight, bodyColor);
|
||||
ArmoredCar = new EntityArmoredCar(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
protected DrawningArmoredCar(int speed, float weight, Color bodyColor, int carWidth, int carHeight) :
|
||||
this(speed, weight, bodyColor)
|
||||
{
|
||||
_carWidth = carWidth;
|
||||
_carHeight = carHeight;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Установка позиции бронированной машины
|
||||
/// </summary>
|
||||
@ -114,24 +121,22 @@ namespace ArmoredCar
|
||||
/// Отрисовка бронированной машины
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
public void DrawTransport(Graphics g)
|
||||
public virtual void DrawTransport(Graphics g)
|
||||
{
|
||||
if (_startPosX < 0 || _startPosY < 0
|
||||
|| !_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
|
||||
|
||||
Brush br = new SolidBrush(ArmoredCar?.BodyColor ?? Color.Black);
|
||||
|
||||
g.FillRectangle(br, _startPosX + 20, _startPosY, 40, 20);
|
||||
g.FillRectangle(br, _startPosX, _startPosY + 20, 80, 20);
|
||||
|
||||
g.FillEllipse(br, _startPosX, _startPosY + 30, 20, 20);
|
||||
|
||||
|
||||
g.FillEllipse(br, _startPosX + 80 - 20, _startPosY + 30, 20, 20);
|
||||
|
||||
|
||||
g.FillRectangle(br, _startPosX + 15, _startPosY + 20, 60, 30);
|
||||
|
||||
Brush brGray = new SolidBrush(Color.LightGray);
|
||||
@ -163,6 +168,14 @@ namespace ArmoredCar
|
||||
_startPosY = _pictureHeight.Value - _carHeight;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получение текущей позиции объекта
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public (float Left, float Right, float Top, float Bottom)
|
||||
GetCurrentPosition()
|
||||
{
|
||||
return (_startPosX, _startPosX + _carWidth, _startPosY, _startPosY + _carHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
37
ArmoredCar/ArmoredCar/DrawningObjectArmCar.cs
Normal file
37
ArmoredCar/ArmoredCar/DrawningObjectArmCar.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
internal class DrawningObjectArmCar : IDrawningObject
|
||||
{
|
||||
private DrawningArmoredCar _armCar = null;
|
||||
public DrawningObjectArmCar(DrawningArmoredCar car)
|
||||
{
|
||||
_armCar = car;
|
||||
}
|
||||
public float Step => _armCar?.ArmoredCar?.Step ?? 0;
|
||||
public (float Left, float Right, float Top, float Bottom)
|
||||
GetCurrentPosition()
|
||||
{
|
||||
return _armCar?.GetCurrentPosition() ?? default;
|
||||
}
|
||||
public void MoveObject(Direction direction)
|
||||
{
|
||||
_armCar?.MoveTransport(direction);
|
||||
}
|
||||
public void SetObject(int x, int y, int width, int height)
|
||||
{
|
||||
_armCar.SetPosition(x, y, width, height);
|
||||
}
|
||||
void IDrawningObject.DrawningObject(Graphics g)
|
||||
{
|
||||
if (_armCar != null)
|
||||
_armCar.DrawTransport(g);
|
||||
}
|
||||
}
|
||||
}
|
52
ArmoredCar/ArmoredCar/DrawningTank.cs
Normal file
52
ArmoredCar/ArmoredCar/DrawningTank.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
internal class DrawningTank : DrawningArmoredCar
|
||||
{
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес бронированной машины</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
/// <param name="dopColor">Дополнительный цвет</param>
|
||||
/// <param name="towerWeapon">Признак наличия башни с орудием</param>
|
||||
/// <param name="aMachineGun">Признак наличия зенитного пулемета</param>
|
||||
public DrawningTank(int speed, float weight, Color bodyColor, Color
|
||||
dopColor, bool towerWeapon, bool aMachineGun) :
|
||||
base(speed, weight, bodyColor, 110, 60)
|
||||
{
|
||||
ArmoredCar = new EntityTank(speed, weight, bodyColor, dopColor, towerWeapon, aMachineGun);
|
||||
}
|
||||
public override void DrawTransport(Graphics g)
|
||||
{
|
||||
if (ArmoredCar is not EntityTank Tank)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Brush dopBrush = new SolidBrush(Tank.DopColor);
|
||||
|
||||
if (Tank.AMachineGun)
|
||||
{
|
||||
g.FillRectangle(dopBrush, _startPosX + 40, _startPosY, 5, 20);
|
||||
g.FillRectangle(dopBrush, _startPosX + 40, _startPosY, 40, 5);
|
||||
g.FillEllipse(dopBrush, _startPosX + 27, _startPosY + 7, 30, 10);
|
||||
}
|
||||
if (Tank.TowerWeapon)
|
||||
{
|
||||
g.FillRectangle(dopBrush, _startPosX + 60, _startPosY + 15, 7, 10);
|
||||
g.FillRectangle(dopBrush, _startPosX + 60, _startPosY + 17, 20, 5);
|
||||
}
|
||||
_startPosY += 10;
|
||||
base.DrawTransport(g);
|
||||
_startPosY -= 10;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -30,7 +30,7 @@ namespace ArmoredCar
|
||||
/// <param name="weight"></param>
|
||||
/// <param name="bodyColor"></param>
|
||||
/// <returns></returns>
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public EntityArmoredCar(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Random rnd = new();
|
||||
Speed = speed <= 0 ? rnd.Next(50, 150) : speed;
|
||||
|
43
ArmoredCar/ArmoredCar/EntityTank.cs
Normal file
43
ArmoredCar/ArmoredCar/EntityTank.cs
Normal file
@ -0,0 +1,43 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
internal class EntityTank : EntityArmoredCar
|
||||
{
|
||||
/// <summary>
|
||||
/// Дополнительный цвет
|
||||
/// </summary>
|
||||
public Color DopColor { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак наличия башни с орудием
|
||||
/// </summary>
|
||||
public bool TowerWeapon { get; private set; }
|
||||
/// <summary>
|
||||
/// Признак наличия зенитного пулемета
|
||||
/// </summary>
|
||||
public bool AMachineGun { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес бронированной машины</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
/// <param name="dopColor">Дополнительный цвет</param>
|
||||
/// <param name="towerWeapon">Признак наличия башни с орудием</param>
|
||||
/// <param name="aMachineGun">Признак наличия зенитного пулемета</param>
|
||||
public EntityTank(int speed, float weight, Color bodyColor, Color
|
||||
dopColor, bool towerWeapon, bool aMachineGun) :
|
||||
base(speed, weight, bodyColor)
|
||||
{
|
||||
DopColor = dopColor;
|
||||
TowerWeapon = towerWeapon;
|
||||
AMachineGun = aMachineGun;
|
||||
}
|
||||
}
|
||||
}
|
@ -36,8 +36,7 @@ namespace ArmoredCar
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
_car = new DrawningArmoredCar();
|
||||
_car.Init(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
||||
_car = new DrawningArmoredCar(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
_car.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxCar.Width, pictureBoxCar.Height);
|
||||
|
||||
|
212
ArmoredCar/ArmoredCar/FormMap.Designer.cs
generated
Normal file
212
ArmoredCar/ArmoredCar/FormMap.Designer.cs
generated
Normal file
@ -0,0 +1,212 @@
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
partial class FormMap
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
|
||||
this.toolStripStatusLabelSpeed = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabelWeight = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.toolStripStatusLabelBodyColor = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.pictureBoxCar = new System.Windows.Forms.PictureBox();
|
||||
this.button1 = new System.Windows.Forms.Button();
|
||||
this.buttonUp = new System.Windows.Forms.Button();
|
||||
this.buttonLeft = new System.Windows.Forms.Button();
|
||||
this.buttonDown = new System.Windows.Forms.Button();
|
||||
this.buttonRight = new System.Windows.Forms.Button();
|
||||
this.button2 = new System.Windows.Forms.Button();
|
||||
this.comboBoxSelectorMap = new System.Windows.Forms.ComboBox();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCar)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// statusStrip1
|
||||
//
|
||||
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.toolStripStatusLabelSpeed,
|
||||
this.toolStripStatusLabelWeight,
|
||||
this.toolStripStatusLabelBodyColor});
|
||||
this.statusStrip1.Location = new System.Drawing.Point(0, 428);
|
||||
this.statusStrip1.Name = "statusStrip1";
|
||||
this.statusStrip1.Size = new System.Drawing.Size(800, 22);
|
||||
this.statusStrip1.TabIndex = 0;
|
||||
this.statusStrip1.Text = "statusStrip1";
|
||||
//
|
||||
// toolStripStatusLabelSpeed
|
||||
//
|
||||
this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed";
|
||||
this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(62, 17);
|
||||
this.toolStripStatusLabelSpeed.Text = "Скорость:";
|
||||
//
|
||||
// toolStripStatusLabelWeight
|
||||
//
|
||||
this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight";
|
||||
this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(32, 17);
|
||||
this.toolStripStatusLabelWeight.Text = "Вес: ";
|
||||
//
|
||||
// toolStripStatusLabelBodyColor
|
||||
//
|
||||
this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor";
|
||||
this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(36, 17);
|
||||
this.toolStripStatusLabelBodyColor.Text = "Цвет:";
|
||||
//
|
||||
// pictureBoxCar
|
||||
//
|
||||
this.pictureBoxCar.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxCar.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxCar.Name = "pictureBoxCar";
|
||||
this.pictureBoxCar.Size = new System.Drawing.Size(800, 428);
|
||||
this.pictureBoxCar.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.pictureBoxCar.TabIndex = 6;
|
||||
this.pictureBoxCar.TabStop = false;
|
||||
//
|
||||
// button1
|
||||
//
|
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.button1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.button1.Location = new System.Drawing.Point(42, 382);
|
||||
this.button1.Name = "button1";
|
||||
this.button1.Size = new System.Drawing.Size(75, 23);
|
||||
this.button1.TabIndex = 7;
|
||||
this.button1.Text = "Создать";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.ButtonCreate_Click);
|
||||
//
|
||||
// buttonUp
|
||||
//
|
||||
this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonUp.BackgroundImage = global::ArmoredCar.Properties.Resources.Up;
|
||||
this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonUp.Location = new System.Drawing.Point(692, 324);
|
||||
this.buttonUp.Name = "buttonUp";
|
||||
this.buttonUp.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonUp.TabIndex = 8;
|
||||
this.buttonUp.UseVisualStyleBackColor = true;
|
||||
this.buttonUp.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonLeft
|
||||
//
|
||||
this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLeft.BackgroundImage = global::ArmoredCar.Properties.Resources.Left;
|
||||
this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonLeft.Location = new System.Drawing.Point(656, 360);
|
||||
this.buttonLeft.Name = "buttonLeft";
|
||||
this.buttonLeft.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonLeft.TabIndex = 9;
|
||||
this.buttonLeft.UseVisualStyleBackColor = true;
|
||||
this.buttonLeft.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonDown
|
||||
//
|
||||
this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonDown.BackgroundImage = global::ArmoredCar.Properties.Resources.Down;
|
||||
this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonDown.Location = new System.Drawing.Point(692, 360);
|
||||
this.buttonDown.Name = "buttonDown";
|
||||
this.buttonDown.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonDown.TabIndex = 10;
|
||||
this.buttonDown.UseVisualStyleBackColor = true;
|
||||
this.buttonDown.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// buttonRight
|
||||
//
|
||||
this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRight.BackgroundImage = global::ArmoredCar.Properties.Resources.Right;
|
||||
this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||
this.buttonRight.Location = new System.Drawing.Point(728, 360);
|
||||
this.buttonRight.Name = "buttonRight";
|
||||
this.buttonRight.Size = new System.Drawing.Size(30, 30);
|
||||
this.buttonRight.TabIndex = 11;
|
||||
this.buttonRight.UseVisualStyleBackColor = true;
|
||||
this.buttonRight.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
//
|
||||
// button2
|
||||
//
|
||||
this.button2.Location = new System.Drawing.Point(154, 382);
|
||||
this.button2.Name = "button2";
|
||||
this.button2.Size = new System.Drawing.Size(95, 23);
|
||||
this.button2.TabIndex = 12;
|
||||
this.button2.Text = "Модификация";
|
||||
this.button2.UseVisualStyleBackColor = true;
|
||||
this.button2.Click += new System.EventHandler(this.ButtonCreateModif_Click);
|
||||
//
|
||||
// comboBoxSelectorMap
|
||||
//
|
||||
this.comboBoxSelectorMap.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSelectorMap.FormattingEnabled = true;
|
||||
this.comboBoxSelectorMap.Items.AddRange(new object[] {
|
||||
"Простая карта",
|
||||
"Карта 1",
|
||||
"Карта 2"});
|
||||
this.comboBoxSelectorMap.Location = new System.Drawing.Point(42, 26);
|
||||
this.comboBoxSelectorMap.Name = "comboBoxSelectorMap";
|
||||
this.comboBoxSelectorMap.Size = new System.Drawing.Size(107, 23);
|
||||
this.comboBoxSelectorMap.TabIndex = 13;
|
||||
this.comboBoxSelectorMap.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelectorMap_SelectedIndexChanged);
|
||||
//
|
||||
// FormMap
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.comboBoxSelectorMap);
|
||||
this.Controls.Add(this.button2);
|
||||
this.Controls.Add(this.buttonRight);
|
||||
this.Controls.Add(this.buttonDown);
|
||||
this.Controls.Add(this.buttonLeft);
|
||||
this.Controls.Add(this.buttonUp);
|
||||
this.Controls.Add(this.button1);
|
||||
this.Controls.Add(this.pictureBoxCar);
|
||||
this.Controls.Add(this.statusStrip1);
|
||||
this.Name = "FormMap";
|
||||
this.Text = "Карта";
|
||||
this.statusStrip1.ResumeLayout(false);
|
||||
this.statusStrip1.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCar)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.StatusStrip statusStrip1;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelSpeed;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelWeight;
|
||||
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelBodyColor;
|
||||
private System.Windows.Forms.PictureBox pictureBoxCar;
|
||||
private System.Windows.Forms.Button button1;
|
||||
private System.Windows.Forms.Button buttonUp;
|
||||
private System.Windows.Forms.Button buttonLeft;
|
||||
private System.Windows.Forms.Button buttonDown;
|
||||
private System.Windows.Forms.Button buttonRight;
|
||||
private System.Windows.Forms.Button button2;
|
||||
private System.Windows.Forms.ComboBox comboBoxSelectorMap;
|
||||
}
|
||||
}
|
||||
|
112
ArmoredCar/ArmoredCar/FormMap.cs
Normal file
112
ArmoredCar/ArmoredCar/FormMap.cs
Normal file
@ -0,0 +1,112 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
public partial class FormMap : Form
|
||||
{
|
||||
|
||||
private AbstractMap _abstractMap;
|
||||
public FormMap()
|
||||
{
|
||||
InitializeComponent();
|
||||
_abstractMap = new SimpleMap();
|
||||
}
|
||||
private void SetData(DrawningArmoredCar car)
|
||||
{
|
||||
toolStripStatusLabelSpeed.Text = $"Скорость: {car.ArmoredCar.Speed}";
|
||||
toolStripStatusLabelWeight.Text = $"Вес: {car.ArmoredCar.Weight}";
|
||||
toolStripStatusLabelBodyColor.Text = $"Цвет:{ car.ArmoredCar.BodyColor.Name}";
|
||||
pictureBoxCar.Image = _abstractMap.CreateMap(pictureBoxCar.Width,
|
||||
pictureBoxCar.Height, new DrawningObjectArmCar(car));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Создать"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
var car = new DrawningArmoredCar(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
SetData(car);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Изменение размеров формы
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonMove_Click(object sender, EventArgs e)
|
||||
{
|
||||
//получаем имя кнопки
|
||||
string name = ((Button)sender)?.Name ?? string.Empty;
|
||||
Direction dir = Direction.None;
|
||||
switch (name)
|
||||
{
|
||||
case "buttonUp":
|
||||
dir = Direction.Up;
|
||||
break;
|
||||
case "buttonDown":
|
||||
dir = Direction.Down;
|
||||
break;
|
||||
case "buttonLeft":
|
||||
dir = Direction.Left;
|
||||
break;
|
||||
case "buttonRight":
|
||||
dir = Direction.Right;
|
||||
break;
|
||||
}
|
||||
pictureBoxCar.Image = _abstractMap?.MoveObject(dir);
|
||||
}
|
||||
/// <summary>
|
||||
/// Обработка нажатия кнопки "Модификация"
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ButtonCreateModif_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
var tank = new DrawningTank(rnd.Next(100, 300), rnd.Next(1000,
|
||||
2000),
|
||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0,
|
||||
256)),
|
||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0,
|
||||
256)),
|
||||
Convert.ToBoolean(rnd.Next(0, 2)), Convert.ToBoolean(rnd.Next(0, 2)));
|
||||
SetData(tank);
|
||||
}
|
||||
/// <summary>
|
||||
/// Смена карты
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
private void ComboBoxSelectorMap_SelectedIndexChanged(object sender,
|
||||
EventArgs e)
|
||||
{
|
||||
switch (comboBoxSelectorMap.Text)
|
||||
{
|
||||
case "Простая карта":
|
||||
_abstractMap = new SimpleMap();
|
||||
break;
|
||||
|
||||
case "Карта 1":
|
||||
_abstractMap = new MyMapWooden();
|
||||
break;
|
||||
case "Карта 2":
|
||||
_abstractMap = new MyMapLabirinth();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
63
ArmoredCar/ArmoredCar/FormMap.resx
Normal file
63
ArmoredCar/ArmoredCar/FormMap.resx
Normal file
@ -0,0 +1,63 @@
|
||||
<root>
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="statusStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
40
ArmoredCar/ArmoredCar/IDrawningObject.cs
Normal file
40
ArmoredCar/ArmoredCar/IDrawningObject.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
internal interface IDrawningObject
|
||||
{
|
||||
/// <summary>
|
||||
/// Шаг перемещения объекта
|
||||
/// </summary>
|
||||
public float Step { get; }
|
||||
/// <summary>
|
||||
/// Установка позиции объекта
|
||||
/// </summary>
|
||||
/// <param name="x">Координата X</param>
|
||||
/// <param name="y">Координата Y</param>
|
||||
/// <param name="width">Ширина полотна</param>
|
||||
/// <param name="height">Высота полотна</param>
|
||||
void SetObject(int x, int y, int width, int height);
|
||||
/// <summary>
|
||||
/// Изменение направления пермещения объекта
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
void MoveObject(Direction direction);
|
||||
/// <summary>
|
||||
/// Отрисовка объекта
|
||||
/// </summary>
|
||||
/// <param name="g"></param>
|
||||
void DrawningObject(Graphics g);
|
||||
/// <summary>
|
||||
/// Получение текущей позиции объекта
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
|
||||
}
|
||||
}
|
73
ArmoredCar/ArmoredCar/MyMapLabirinth.cs
Normal file
73
ArmoredCar/ArmoredCar/MyMapLabirinth.cs
Normal file
@ -0,0 +1,73 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
internal class MyMapLabirinth : AbstractMap
|
||||
{
|
||||
/// <summary>
|
||||
/// Цвет участка закрытого
|
||||
/// </summary>
|
||||
private readonly Brush barrierTreeColor = new SolidBrush(Color.Lime);
|
||||
/// <summary>
|
||||
/// Цвет участка открытого
|
||||
/// </summary>
|
||||
private readonly Brush roadColor = new SolidBrush(Color.SandyBrown);
|
||||
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
||||
{
|
||||
g.FillRectangle(barrierTreeColor, i * _size_x, j * _size_y, _size_x * 2, _size_y * 2);
|
||||
}
|
||||
protected override void DrawRoadPart(Graphics g, int i, int j)
|
||||
{
|
||||
g.FillRectangle(roadColor, i * _size_x, j * _size_y, _size_x * 2, _size_y * 2);
|
||||
}
|
||||
protected override void GenerateMap()
|
||||
{
|
||||
_map = new int[50, 50];
|
||||
_size_x = (float)_width / _map.GetLength(0);
|
||||
_size_y = (float)_height / _map.GetLength(1);
|
||||
int counter = 0;
|
||||
for (int i = 0; i < _map.GetLength(0); ++i)
|
||||
{
|
||||
for (int j = 0; j < _map.GetLength(1); ++j)
|
||||
{
|
||||
_map[i, j] = _freeRoad;
|
||||
}
|
||||
}
|
||||
|
||||
while (counter < 20)
|
||||
{
|
||||
int x = _random.Next(0, 50);
|
||||
int y = _random.Next(0, 50);
|
||||
int number = _random.Next(1, 15);
|
||||
if (counter < 5) {
|
||||
if (number + x > _map.GetLength(0))
|
||||
{
|
||||
number = _map.GetLength(0) - x - 1;
|
||||
}
|
||||
for (int i = x; i < x + number; ++i)
|
||||
{
|
||||
_map[i, y] = _barrier;
|
||||
}
|
||||
} else
|
||||
{
|
||||
if (number + y > _map.GetLength(1))
|
||||
{
|
||||
number = _map.GetLength(1) - y - 1;
|
||||
}
|
||||
for (int i = y; i < y + number; ++i)
|
||||
{
|
||||
_map[x, i] = _barrier;
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
54
ArmoredCar/ArmoredCar/MyMapWooden.cs
Normal file
54
ArmoredCar/ArmoredCar/MyMapWooden.cs
Normal file
@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
internal class MyMapWooden : AbstractMap
|
||||
{
|
||||
/// <summary>
|
||||
/// Цвет участка закрытого
|
||||
/// </summary>
|
||||
private readonly Brush barrierTreeColor = new SolidBrush(Color.LightGreen);
|
||||
/// <summary>
|
||||
/// Цвет участка открытого
|
||||
/// </summary>
|
||||
private readonly Brush roadColor = new SolidBrush(Color.Brown);
|
||||
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
||||
{
|
||||
g.FillRectangle(barrierTreeColor, i * _size_x, j * _size_y, _size_x * 2, _size_y * 2);
|
||||
}
|
||||
protected override void DrawRoadPart(Graphics g, int i, int j)
|
||||
{
|
||||
g.FillRectangle(roadColor, i * _size_x, j * _size_y, _size_x * 2, _size_y * 2 );
|
||||
}
|
||||
protected override void GenerateMap()
|
||||
{
|
||||
_map = new int[50, 50];
|
||||
_size_x = (float)_width / _map.GetLength(0);
|
||||
_size_y = (float)_height / _map.GetLength(1);
|
||||
int counter = 0;
|
||||
for (int i = 0; i < _map.GetLength(0); ++i)
|
||||
{
|
||||
for (int j = 0; j < _map.GetLength(1); ++j)
|
||||
{
|
||||
_map[i, j] = _freeRoad;
|
||||
}
|
||||
}
|
||||
while (counter < 25)
|
||||
{
|
||||
int x = _random.Next(0, 50);
|
||||
int y = _random.Next(0, 50);
|
||||
if (_map[x, y] == _freeRoad)
|
||||
{
|
||||
_map[x, y] = _barrier;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ namespace ArmoredCar
|
||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new FormCar());
|
||||
Application.Run(new FormMap());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
53
ArmoredCar/ArmoredCar/SimpleMap.cs
Normal file
53
ArmoredCar/ArmoredCar/SimpleMap.cs
Normal file
@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ArmoredCar
|
||||
{
|
||||
internal class SimpleMap : AbstractMap
|
||||
{
|
||||
/// <summary>
|
||||
/// Цвет участка закрытого
|
||||
/// </summary>
|
||||
private readonly Brush barrierColor = new SolidBrush(Color.Black);
|
||||
/// <summary>
|
||||
/// Цвет участка открытого
|
||||
/// </summary>
|
||||
private readonly Brush roadColor = new SolidBrush(Color.Gray);
|
||||
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
||||
{
|
||||
g.FillRectangle(barrierColor, i * _size_x, j * _size_y, _size_x, _size_y);
|
||||
}
|
||||
protected override void DrawRoadPart(Graphics g, int i, int j)
|
||||
{
|
||||
g.FillRectangle(roadColor, i * _size_x, j * _size_y, _size_x, _size_y);
|
||||
}
|
||||
protected override void GenerateMap()
|
||||
{
|
||||
_map = new int[100, 100];
|
||||
_size_x = (float)_width / _map.GetLength(0);
|
||||
_size_y = (float)_height / _map.GetLength(1);
|
||||
int counter = 0;
|
||||
for (int i = 0; i < _map.GetLength(0); ++i)
|
||||
{
|
||||
for (int j = 0; j < _map.GetLength(1); ++j)
|
||||
{
|
||||
_map[i, j] = _freeRoad;
|
||||
}
|
||||
}
|
||||
while (counter < 50)
|
||||
{
|
||||
int x = _random.Next(0, 100);
|
||||
int y = _random.Next(0, 100);
|
||||
if (_map[x, y] == _freeRoad)
|
||||
{
|
||||
_map[x, y] = _barrier;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user