From ec182e5534b38f17738dfe72095f4ab0156d2dde Mon Sep 17 00:00:00 2001 From: "evasina2312@gmail.com" Date: Thu, 13 Oct 2022 15:15:54 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9B=D0=B0=D0=B1=D0=BE=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=BD=D0=B0=D1=8F=5F2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectMachine/ProjectMachine/AbstractMap.cs | 8 ++++---- ProjectMachine/ProjectMachine/DrawningTank.cs | 8 ++++---- ProjectMachine/ProjectMachine/FormMap.cs | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ProjectMachine/ProjectMachine/AbstractMap.cs b/ProjectMachine/ProjectMachine/AbstractMap.cs index bdc975c..02e3c4c 100644 --- a/ProjectMachine/ProjectMachine/AbstractMap.cs +++ b/ProjectMachine/ProjectMachine/AbstractMap.cs @@ -70,28 +70,28 @@ namespace ProjectMachine case Direction.Left: for (int i = GetCoord().TopCoord; i <= GetCoord().BottomCoord; i++) { - if (_map[GetCoord().LeftCoord - 1, i] == _barrier) + if (_map[GetCoord().LeftCoord - (int)((_drawningObject.Step) / _size_x) - 1, i] == _barrier) return false; } break; case Direction.Right: for (int i = GetCoord().TopCoord; i < GetCoord().BottomCoord; i++) { - if (_map[GetCoord().RightCoord + 1, i] == _barrier) + if (_map[GetCoord().RightCoord + (int)((_drawningObject.Step) / _size_x) + 1, i] == _barrier) return false; } break; case Direction.Up: for (int i = GetCoord().LeftCoord; i < GetCoord().RightCoord; i++) { - if (_map[i, GetCoord().TopCoord - 1] == _barrier) + if (_map[i, GetCoord().TopCoord - (int)((_drawningObject.Step) / _size_y) - 1] == _barrier) return false; } break; case Direction.Down: for (int i = GetCoord().LeftCoord; i < GetCoord().RightCoord; i++) { - if (_map[i, GetCoord().BottomCoord + 1] == _barrier) + if (_map[i, GetCoord().BottomCoord + (int)((_drawningObject.Step) / _size_y) + 1] == _barrier) return false; } break; diff --git a/ProjectMachine/ProjectMachine/DrawningTank.cs b/ProjectMachine/ProjectMachine/DrawningTank.cs index 0adccfd..9b54b99 100644 --- a/ProjectMachine/ProjectMachine/DrawningTank.cs +++ b/ProjectMachine/ProjectMachine/DrawningTank.cs @@ -15,7 +15,6 @@ namespace ProjectMachine /// Вес автомобиля /// Цвет кузова /// Дополнительный цвет - /// Признак наличия обвеса /// Признак наличия башни с орудием /// Признак наличия зенитного пулемета public DrawningTank(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool turret, bool gun) : @@ -33,15 +32,16 @@ namespace ProjectMachine Pen pen = new(Color.Black); Brush dopBrush = new SolidBrush(tank.DopColor); - if (tank.BodyKit) + if (tank.Turret) { g.FillRectangle(dopBrush, _startPosX + 45, _startPosY, 20, 10); g.DrawLine(pen, _startPosX + 65, _startPosY + 2, _startPosX + 85, _startPosY + 2); } - if (tank.Turret) + if (tank.Gun) { - g.FillRectangle(dopBrush, _startPosX + 45, _startPosY, 20, 10); + g.FillRectangle(dopBrush, _startPosX + 23, _startPosY + 4, 3, 11); + g.DrawLine(pen, _startPosX + 23, _startPosY + 8, _startPosX + 5, _startPosY + 8); } _startPosX += 10; diff --git a/ProjectMachine/ProjectMachine/FormMap.cs b/ProjectMachine/ProjectMachine/FormMap.cs index da73052..c0d2c50 100644 --- a/ProjectMachine/ProjectMachine/FormMap.cs +++ b/ProjectMachine/ProjectMachine/FormMap.cs @@ -39,7 +39,7 @@ namespace ProjectMachine private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - var machine = new DrawningMachine(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + var machine = new DrawningMachine(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); SetData(machine); } /// -- 2.25.1