From 72b7375d44ec4a1def286626327ab2a28399288c Mon Sep 17 00:00:00 2001 From: mara-1 <147929076+mara-1@users.noreply.github.com> Date: Tue, 12 Mar 2024 16:39:33 +0400 Subject: [PATCH 1/4] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=80=D0=BE=D0=B4=D0=B8=D1=82=D0=B5=D0=BB?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=B8=20=D0=B2=D0=B2=D0=BE=D0=B4=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA=D1=82=D0=BE=D1=80=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectBulldozer/DrawingBulldozer.cs | 278 ------------------ .../DirectionType.cs} | 10 +- .../Drawnings/DrawingBulldozer.cs | 104 +++++++ .../Drawnings/DrawningBulldozerProstoy.cs | 234 +++++++++++++++ .../{ => Entities}/EntityBulldozer.cs | 34 +-- .../Entities/EntityBulldozerProstoy.cs | 41 +++ .../FormBulldozer.Designer.cs | 18 +- .../ProjectBulldozer/FormBulldozer.cs | 74 +++-- 8 files changed, 458 insertions(+), 335 deletions(-) delete mode 100644 ProjectBulldozer/ProjectBulldozer/DrawingBulldozer.cs rename ProjectBulldozer/ProjectBulldozer/{DirectionType1.cs => Drawnings/DirectionType.cs} (59%) create mode 100644 ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs create mode 100644 ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozerProstoy.cs rename ProjectBulldozer/ProjectBulldozer/{ => Entities}/EntityBulldozer.cs (63%) create mode 100644 ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozerProstoy.cs diff --git a/ProjectBulldozer/ProjectBulldozer/DrawingBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/DrawingBulldozer.cs deleted file mode 100644 index 0ca5b8b..0000000 --- a/ProjectBulldozer/ProjectBulldozer/DrawingBulldozer.cs +++ /dev/null @@ -1,278 +0,0 @@ -namespace ProjectBulldozer; - -/// -/// Класс, отвечающий за прорисовку и перемещение объекта-сущности -/// -public class DrawningBulldozer -{ - /// - /// Класс-сущность - /// - public EntityBulldozer? EntityBulldozer { get; private set; } - /// - /// Ширина окна - /// - private int? _pictureWidth; - /// - /// Высота окна - /// - private int? _pictureHeight; - /// - /// Левая координата прорисовки автомобиля - /// - private int? _startPosX; - /// - /// Верхняя кооридната прорисовки автомобиля - /// - private int? _startPosY; - - /// - /// Ширина прорисовки автомобиля - /// - private readonly int _BulldozerWidth = 180; - /// - /// Высота прорисовки автомобиля - /// - private readonly int _BulldozerHeight = 140; - /// - /// Инициализация свойств - /// - /// Скорость - /// Вес - /// Основной цвет - /// Дополнительный цвет - /// Признак наличия отвала спереди - /// Признак наличия рыхлителя сзади - - public void Init(int speed, double weight, Color bodyColor, Color - additionalColor, bool additionalOtval, bool additionalRihl) - { - EntityBulldozer = new EntityBulldozer(); - EntityBulldozer.Init(speed, weight, bodyColor, additionalColor, additionalOtval, - additionalRihl); - - _pictureWidth = null; - _pictureHeight = null; - _startPosX = null; - _startPosY = null; - - } - /// - /// Установка границ поля - /// - /// Ширина поля - /// Высота поля - /// true - границы заданы, false - проверка не пройдена, нельзя - public bool SetPictureSize(int width, int height) - { - if (_BulldozerWidth < width && _BulldozerHeight < height) - { - _pictureWidth = width; - _pictureHeight = height; - if (_startPosX.HasValue && _startPosY.HasValue) - { - SetPosition(_startPosX.Value, _startPosY.Value); - } - - return true; - } - return false; - } - /// - /// Установка позиции - /// - /// Координата X - /// Координата Y - public void SetPosition(int x, int y) - { - if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) - { - return; - } - if (x < 0 || x + _BulldozerWidth > _pictureWidth || y < 0 || y + _BulldozerHeight > _pictureHeight) - { - _startPosX = _pictureWidth - _BulldozerWidth; - _startPosY = _pictureHeight - _BulldozerHeight; - } - else - { - _startPosX = x; - _startPosY = y; - } - } - /// - /// Изменение направления перемещения - /// - /// Направление - /// true - перемещене выполнено, false - перемещение - public bool MoveTransport(DirectionType1 direction) { - - if (EntityBulldozer == null || !_startPosX.HasValue || - !_startPosY.HasValue) - { - return false; - } - switch (direction) - { - //влево - case DirectionType1.Left: - if (_startPosX.Value - EntityBulldozer.Step > 0) - { - _startPosX -= (int)EntityBulldozer.Step; - } - return true; - - //вверх - case DirectionType1.Up: - if (_startPosY.Value - EntityBulldozer.Step > 0) - { - _startPosY -= (int)EntityBulldozer.Step; - } - return true; - - // вправо - case DirectionType1.Right: - if (_startPosX + _BulldozerWidth + EntityBulldozer.Step < _pictureWidth) - { - _startPosX += (int)EntityBulldozer.Step; - } - return true; - - //вниз - case DirectionType1.Down: - if (_startPosY + _BulldozerHeight + EntityBulldozer.Step < _pictureHeight) - { - _startPosY += (int)EntityBulldozer.Step; - } - return true; - default: - return false; - } - } - - /// - /// Прорисовка объекта - /// - /// - public void DrawTransport(Graphics g) - { - if (EntityBulldozer == null || !_startPosX.HasValue || - !_startPosY.HasValue) - { - return; - } - Pen pen = new(Color.Black); - Brush brush = new SolidBrush(Color.Black); - Brush bl = new SolidBrush(EntityBulldozer.AdditionalColor); - Brush bodyBrush = new SolidBrush(EntityBulldozer.BodyColor); - Brush bodyBrush2 = new SolidBrush(EntityBulldozer.AdditionalColor); - - - - - //основное тело - g.FillRectangle(bodyBrush, _startPosX.Value + 20, _startPosY.Value + 40, 120, 60); - - g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 40, 120, 60); - - - - //Гусеницы - Brush gg = new SolidBrush(Color.LightGray); - g.FillEllipse(gg, _startPosX.Value + 23, _startPosY.Value + 101, 118, 35); - g.DrawEllipse(pen, _startPosX.Value + 23, _startPosY.Value + 101, 118, 35); - - - - - g.DrawEllipse(pen, _startPosX.Value + 26, _startPosY.Value + 103, 110, 30); - - //катки в гусеницах - Brush gr = new SolidBrush(Color.Gray); - g.FillEllipse(gr, _startPosX.Value + 40, _startPosY.Value + 108, 20, 20); - g.DrawEllipse(pen, _startPosX.Value + 40, _startPosY.Value + 108, 20, 20); - - - g.FillEllipse(gr, _startPosX.Value + 65, _startPosY.Value + 110, 20, 20); - g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 110, 20, 20); - - g.FillEllipse(gr, _startPosX.Value + 115, _startPosY.Value + 110, 15, 15); - g.DrawEllipse(pen, _startPosX.Value + 115, _startPosY.Value + 110, 15, 15); - - g.FillEllipse(gr, _startPosX.Value + 90, _startPosY.Value + 110, 20, 20); - g.DrawEllipse(pen, _startPosX.Value + 90, _startPosY.Value + 110, 20, 20); - - - - - //кабина водителя - g.FillRectangle(bodyBrush2, _startPosX.Value + 20, _startPosY.Value, 40, 40); - g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value, 40, 40); - - - //выхлопная труба - Brush brBr = new SolidBrush(Color.Brown); - - g.FillRectangle(brBr, _startPosX.Value + 110, _startPosY.Value, 15, 40); - g.DrawRectangle(pen, _startPosX.Value + 110, _startPosY.Value, 15, 40); - - - - //Brush bl = new SolidBrush(Color.LightYellow); - /////////отвал - /// - if (EntityBulldozer.AdditionalOtval) - { - Point[] Otval = - { - new Point(_startPosX.Value + 142, _startPosY.Value + 70), - new Point(_startPosX.Value + 172, _startPosY.Value + 130), - new Point(_startPosX.Value+ 142, _startPosY.Value + 130), - - - }; - - g.FillPolygon(bl, Otval); - g.DrawPolygon(pen, Otval); - } - - - - - - ///рыхлитель - if (EntityBulldozer.AdditionalRihl) - { - Brush black = new SolidBrush(Color.Black); - Point[] Rihl = - { - new Point(_startPosX.Value + 18 , _startPosY.Value + 60), - new Point(_startPosX.Value + 18, _startPosY.Value + 80), - new Point(_startPosX.Value, _startPosY.Value + 120), - - }; - - g.FillPolygon(black, Rihl); - g.DrawPolygon(pen, Rihl); - - Point[] Ttt = - { - new Point(_startPosX.Value + 18 , _startPosY.Value + 80), - new Point(_startPosX.Value + 18, _startPosY.Value + 120), - new Point(_startPosX.Value, _startPosY.Value + 50), - - }; - g.FillPolygon(black, Ttt); - g.DrawPolygon(pen, Ttt); - - } - - - - - - } -} - - - diff --git a/ProjectBulldozer/ProjectBulldozer/DirectionType1.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DirectionType.cs similarity index 59% rename from ProjectBulldozer/ProjectBulldozer/DirectionType1.cs rename to ProjectBulldozer/ProjectBulldozer/Drawnings/DirectionType.cs index 0afc190..9607f86 100644 --- a/ProjectBulldozer/ProjectBulldozer/DirectionType1.cs +++ b/ProjectBulldozer/ProjectBulldozer/Drawnings/DirectionType.cs @@ -1,12 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +namespace ProjectBulldozer.Drawnings; -namespace ProjectBulldozer; - -public enum DirectionType1 +public enum DirectionType { /// /// Вверх diff --git a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs new file mode 100644 index 0000000..05f54f3 --- /dev/null +++ b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs @@ -0,0 +1,104 @@ +using ProjectBulldozer.Entities; +using System.Drawing; + +namespace ProjectBulldozer.Drawnings; + +/// +/// Класс, отвечающий за прорисовку и перемещение объекта-сущности +/// +public class DrawningBulldozer : DrawningBulldozerProstoy +{ + + /// + /// конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + /// Дополнительный цвет + /// Признак наличия отвала спереди + /// Признак наличия рыхлителя сзади + + public DrawningBulldozer(int speed, double weight, Color bodyColor, Color + additionalColor, bool additionalOtval, bool additionalRihl, bool v) : base(180, 140) + { + EntityBulldozerProstoy = new EntityBulldozer(speed, weight, bodyColor, additionalColor, additionalOtval, + additionalRihl); + } + public override void DrawTransport(Graphics g) + { + if (EntityBulldozerProstoy == null || EntityBulldozerProstoy is not EntityBulldozer Bulldozer || !_startPosX.HasValue || !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + Brush bodyBrush = new SolidBrush(Bulldozer.BodyColor); + Brush bodyBrush2 = new SolidBrush(Bulldozer.AdditionalColor); + + + + + _startPosX += 10; + _startPosY += 5; + + base.DrawTransport(g); + _startPosX -= 10; + _startPosY -= 5; + + Brush bl = new SolidBrush(Bulldozer.AdditionalColor); + /////////отвал + /// + if (Bulldozer.AdditionalOtval) + { + Point[] Otval = + { + new Point(_startPosX.Value + 142, _startPosY.Value + 70), + new Point(_startPosX.Value + 172, _startPosY.Value + 130), + new Point(_startPosX.Value+ 142, _startPosY.Value + 130), + + + }; + + g.FillPolygon(bl, Otval); + g.DrawPolygon(pen, Otval); + } + + + + + + ///рыхлитель + if (Bulldozer.AdditionalRihl) + { + Brush black = new SolidBrush(Color.Black); + Point[] Rihl = + { + new Point(_startPosX.Value + 18 , _startPosY.Value + 60), + new Point(_startPosX.Value + 18, _startPosY.Value + 80), + new Point(_startPosX.Value, _startPosY.Value + 120), + + }; + + g.FillPolygon(black, Rihl); + g.DrawPolygon(pen, Rihl); + + Point[] Ttt = + { + new Point(_startPosX.Value + 18 , _startPosY.Value + 80), + new Point(_startPosX.Value + 18, _startPosY.Value + 120), + new Point(_startPosX.Value, _startPosY.Value + 50), + + }; + g.FillPolygon(black, Ttt); + g.DrawPolygon(pen, Ttt); + + } + } +} + + + + + + diff --git a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozerProstoy.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozerProstoy.cs new file mode 100644 index 0000000..1522616 --- /dev/null +++ b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozerProstoy.cs @@ -0,0 +1,234 @@ +using ProjectBulldozer.Entities; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectBulldozer.Drawnings; + +public class DrawningBulldozerProstoy +{ + /// + /// Класс-сущность + /// + public EntityBulldozerProstoy? EntityBulldozerProstoy { get; protected set; } + /// + /// Ширина окна + /// + private int? _pictureWidth; + /// + /// Высота окна + /// + private int? _pictureHeight; + /// + /// Левая координата прорисовки автомобиля + /// + protected int? _startPosX; + /// + /// Верхняя кооридната прорисовки автомобиля + /// + protected int? _startPosY; + + /// + /// Ширина прорисовки бульдозера + /// + private readonly int _BulldozerWidth = 130; + /// + /// Высота прорисовки бульдозера + /// + private readonly int _BulldozerHeight = 120; + + /// + /// Пустой конструктор + /// + private DrawningBulldozerProstoy() + { + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + } + + /// + /// Конструктор + /// + /// Скорость + /// Вес + /// Основной цвет + public DrawningBulldozerProstoy(int speed, double weight, Color bodyColor) : this() + { + EntityBulldozerProstoy = new EntityBulldozerProstoy(speed, weight, bodyColor); + _pictureWidth = null; + _pictureHeight = null; + _startPosX = null; + _startPosY = null; + + } + + /// + /// Конструктор для наследников + /// + /// Ширина прорисовки бульдозера + /// Высота прорисовки бульдозера + protected DrawningBulldozerProstoy(int BulldozerWidth, int BulldozerHeight) : this() + { + _BulldozerWidth = BulldozerWidth; + _BulldozerHeight = BulldozerHeight; + + + } + + /// + /// Установка границ поля + /// + /// Ширина поля + /// Высота поля + /// true - границы заданы, false - проверка не пройдена, нельзя + public bool SetPictureSize(int width, int height) + { + if (_BulldozerWidth < width && _BulldozerHeight < height) + { + _pictureWidth = width; + _pictureHeight = height; + if (_startPosX.HasValue && _startPosY.HasValue) + { + SetPosition(_startPosX.Value, _startPosY.Value); + } + + return true; + } + return false; + } + /// + /// Установка позиции + /// + /// Координата X + /// Координата Y + public void SetPosition(int x, int y) + { + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + if (x < 0 || x + _BulldozerWidth > _pictureWidth || y < 0 || y + _BulldozerHeight > _pictureHeight) + { + _startPosX = _pictureWidth - _BulldozerWidth; + _startPosY = _pictureHeight - _BulldozerHeight; + } + else + { + _startPosX = x; + _startPosY = y; + } + } + /// + /// Изменение направления перемещения + /// + /// Направление + /// true - перемещене выполнено, false - перемещение + public bool MoveTransport(DirectionType direction) + { + + if (EntityBulldozerProstoy == null || !_startPosX.HasValue || + !_startPosY.HasValue) + { + return false; + } + switch (direction) + { + //влево + case DirectionType.Left: + if (_startPosX.Value - EntityBulldozerProstoy.Step > 0) + { + _startPosX -= (int)EntityBulldozerProstoy.Step; + } + return true; + + //вверх + case DirectionType.Up: + if (_startPosY.Value - EntityBulldozerProstoy.Step > 0) + { + _startPosY -= (int)EntityBulldozerProstoy.Step; + } + return true; + + // вправо + case DirectionType.Right: + if (_startPosX + _BulldozerWidth + EntityBulldozerProstoy.Step < _pictureWidth) + { + _startPosX += (int)EntityBulldozerProstoy.Step; + } + return true; + + //вниз + case DirectionType.Down: + if (_startPosY + _BulldozerHeight + EntityBulldozerProstoy.Step < _pictureHeight) + { + _startPosY += (int)EntityBulldozerProstoy.Step; + } + return true; + default: + return false; + } + } + + /// + /// Прорисовка объекта + /// + /// + public virtual void DrawTransport(Graphics g) + { + if (EntityBulldozerProstoy == null || !_startPosX.HasValue || + !_startPosY.HasValue) + { + return; + } + + Pen pen = new(Color.Black); + Brush brush = new SolidBrush(Color.Black); + Brush bodyBrush = new SolidBrush(EntityBulldozerProstoy.BodyColor); + + + //основное тело + g.FillRectangle(bodyBrush, _startPosX.Value + 10, _startPosY.Value + 35, 120, 60); + g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 35, 120, 60); + + + + //Гусеницы + Brush gg = new SolidBrush(Color.LightGray); + g.FillEllipse(gg, _startPosX.Value + 13, _startPosY.Value + 96, 118, 35); + g.DrawEllipse(pen, _startPosX.Value + 13, _startPosY.Value + 96, 118, 35); + + g.DrawEllipse(pen, _startPosX.Value + 16, _startPosY.Value + 98, 110, 30); + + //катки в гусеницах + Brush gr = new SolidBrush(Color.Gray); + g.FillEllipse(gr, _startPosX.Value + 30, _startPosY.Value + 104, 20, 20); + g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 104, 20, 20);//// + + + g.FillEllipse(gr, _startPosX.Value + 55, _startPosY.Value + 105, 20, 20); + g.DrawEllipse(pen, _startPosX.Value + 55, _startPosY.Value + 105, 20, 20); + + g.FillEllipse(gr, _startPosX.Value + 105, _startPosY.Value + 105, 15, 15); + g.DrawEllipse(pen, _startPosX.Value + 105, _startPosY.Value + 105, 15, 15); + + g.FillEllipse(gr, _startPosX.Value + 80, _startPosY.Value + 105, 20, 20); + g.DrawEllipse(pen, _startPosX.Value + 80, _startPosY.Value + 105, 20, 20); + + //кабина водителя + g.FillRectangle(bodyBrush, _startPosX.Value + 10, _startPosY.Value, 40, 40); + g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value, 40, 40); + + + //выхлопная труба + Brush brBr = new SolidBrush(Color.Brown); + + g.FillRectangle(brBr, _startPosX.Value + 100, _startPosY.Value, 15, 40); + g.DrawRectangle(pen, _startPosX.Value + 100, _startPosY.Value, 15, 40); + + + } +} diff --git a/ProjectBulldozer/ProjectBulldozer/EntityBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs similarity index 63% rename from ProjectBulldozer/ProjectBulldozer/EntityBulldozer.cs rename to ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs index 49856e7..c2be6f2 100644 --- a/ProjectBulldozer/ProjectBulldozer/EntityBulldozer.cs +++ b/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs @@ -1,20 +1,11 @@ - -namespace ProjectBulldozer; +namespace ProjectBulldozer.Entities; -public class EntityBulldozer +public class EntityBulldozer : EntityBulldozerProstoy { - /// - /// Скорость - /// - public int Speed { get; private set; } - /// - /// Вес - /// - public double Weight { get; private set; } - /// - /// Основной цвет - /// - public Color BodyColor { get; private set; } + public EntityBulldozer(int speed, double weight, Color bodyColor) : base(speed, weight, bodyColor) + { + } + /// /// Дополнительный цвет (для опциональных элементов) /// @@ -28,10 +19,8 @@ public class EntityBulldozer /// public bool AdditionalRihl { get; private set; } - /// - /// Шаг перемещения автомобиля - /// - public double Step => Speed * 100 / Weight; + + /// /// Инициализация полей объекта-класса спортивного автомобиля /// @@ -41,12 +30,9 @@ public class EntityBulldozer /// Дополнительный цвет /// Признак наличия отвала спереди /// Признак наличия рыхлителя сзади - public void Init(int speed, double weight, Color bodyColor, Color - additionalColor, bool additionalOtval, bool additionalRihl) + public EntityBulldozer(int speed, double weight, Color bodyColor, Color + additionalColor, bool additionalOtval, bool additionalRihl) : base(speed, weight, bodyColor) { - Speed = speed; - Weight = weight; - BodyColor = bodyColor; AdditionalColor = additionalColor; AdditionalOtval = additionalOtval; AdditionalRihl = additionalRihl; diff --git a/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozerProstoy.cs b/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozerProstoy.cs new file mode 100644 index 0000000..ec67c8b --- /dev/null +++ b/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozerProstoy.cs @@ -0,0 +1,41 @@ +namespace ProjectBulldozer.Entities; + +/// +/// Класс-сущность "Бульдозер простой" +/// +public class EntityBulldozerProstoy +{ + /// + /// Скорость + /// + public int Speed { get; private set; } + /// + /// Вес + /// + public double Weight { get; private set; } + /// + /// Основной цвет + /// + public Color BodyColor { get; private set; } + + /// + /// Шаг перемещения автомобиля + /// + public double Step => Speed * 100 / Weight; + + /// + /// Конструктор сущности + /// + /// Скорость + /// Вес автомобиля + /// Основной цвет + + public EntityBulldozerProstoy(int speed, double weight, Color bodyColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + + + } +} diff --git a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs index 5d8a28c..013d371 100644 --- a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs +++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs @@ -34,6 +34,7 @@ buttonDown = new Button(); buttonLeft = new Button(); buttonUp = new Button(); + buttonCreateBulldozerProstoy = new Button(); ((System.ComponentModel.ISupportInitialize)pictureBoxBulldozer).BeginInit(); SuspendLayout(); // @@ -51,9 +52,9 @@ buttonCreate.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; buttonCreate.Location = new Point(12, 511); buttonCreate.Name = "buttonCreate"; - buttonCreate.Size = new Size(94, 29); + buttonCreate.Size = new Size(231, 29); buttonCreate.TabIndex = 1; - buttonCreate.Text = "Создать"; + buttonCreate.Text = "Создать бульозер с доп."; buttonCreate.UseVisualStyleBackColor = true; buttonCreate.Click += ButtonCreateBulldozer_Click; // @@ -105,9 +106,21 @@ buttonUp.UseVisualStyleBackColor = true; buttonUp.Click += ButtonMove_Click; // + // buttonCreateBulldozerProstoy + // + buttonCreateBulldozerProstoy.Anchor = AnchorStyles.Bottom | AnchorStyles.Left; + buttonCreateBulldozerProstoy.Location = new Point(274, 511); + buttonCreateBulldozerProstoy.Name = "buttonCreateBulldozerProstoy"; + buttonCreateBulldozerProstoy.Size = new Size(231, 29); + buttonCreateBulldozerProstoy.TabIndex = 6; + buttonCreateBulldozerProstoy.Text = "Создать простой бульдозер"; + buttonCreateBulldozerProstoy.UseVisualStyleBackColor = true; + buttonCreateBulldozerProstoy.Click += buttonCreateBulldozerProstoy_Click; + // // FormBulldozer // ClientSize = new Size(899, 552); + Controls.Add(buttonCreateBulldozerProstoy); Controls.Add(buttonUp); Controls.Add(buttonLeft); Controls.Add(buttonDown); @@ -128,5 +141,6 @@ private Button buttonDown; private Button buttonLeft; private Button buttonUp; + private Button buttonCreateBulldozerProstoy; } } \ No newline at end of file diff --git a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs index ffb86de..5aa2a3d 100644 --- a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs +++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using ProjectBulldozer.Drawnings; namespace ProjectBulldozer { @@ -15,7 +16,7 @@ namespace ProjectBulldozer /// /// Поле-объект для прорисовки объекта /// - private DrawningBulldozer? _drawningBulldozer; + private DrawningBulldozerProstoy? _drawningBulldozerProstoy; /// /// Конструктор формы /// @@ -28,34 +29,61 @@ namespace ProjectBulldozer /// private void Draw() { - if (_drawningBulldozer == null) + if (_drawningBulldozerProstoy == null) { return; } Bitmap bmp = new(pictureBoxBulldozer.Width, pictureBoxBulldozer.Height); Graphics gr = Graphics.FromImage(bmp); - _drawningBulldozer.DrawTransport(gr); + _drawningBulldozerProstoy.DrawTransport(gr); pictureBoxBulldozer.Image = bmp; } + /// - /// Обработка нажатия кнопки "Создать" + /// создеание объекта класса-перемещения + /// + /// Тип создаваемого объекта + private void CreateObject(string type) + { + Random random = new(); + switch (type) + { + case nameof(DrawningBulldozerProstoy): + _drawningBulldozerProstoy = new DrawningBulldozerProstoy(random.Next(100, 300),random.Next(1000, 3000), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); + break; + case nameof(DrawningBulldozer): + _drawningBulldozerProstoy = new DrawningBulldozer(random.Next(100,300), random.Next(1000, 3000), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), + Convert.ToBoolean(random.Next(0, 2)), + Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); + break; + default: + return; + } + + _drawningBulldozerProstoy.SetPictureSize(pictureBoxBulldozer.Width,pictureBoxBulldozer.Height); + _drawningBulldozerProstoy.SetPosition(random.Next(10, 100), random.Next(10, 100)); + Draw(); + } + + + /// + /// Обработка нажатия кнопки "Создать бульдозер с доп." /// /// /// - private void ButtonCreateBulldozer_Click(object sender, EventArgs e) - { - Random random = new(); - _drawningBulldozer = new DrawningBulldozer(); - - _drawningBulldozer.Init(random.Next(100, 300), random.Next(1000, 3000), - Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), - Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), - Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2))); - _drawningBulldozer.SetPictureSize(pictureBoxBulldozer.Width, pictureBoxBulldozer.Height); - _drawningBulldozer.SetPosition(random.Next(10, 100), random.Next(10, 100)); - Draw(); - } + private void ButtonCreateBulldozer_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBulldozer)); + + /// + /// Обработка нажатия кнопки "Создать обычный бульдозер" + /// + /// + /// + private void buttonCreateBulldozerProstoy_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBulldozerProstoy)); + /// /// Перемещение объекта по форме (нажатие кнопок навигации) /// @@ -63,7 +91,7 @@ namespace ProjectBulldozer /// private void ButtonMove_Click(object sender, EventArgs e) { - if (_drawningBulldozer == null) + if (_drawningBulldozerProstoy == null) { return; } @@ -73,19 +101,19 @@ namespace ProjectBulldozer { case "buttonUp": result = - _drawningBulldozer.MoveTransport(DirectionType1.Up); + _drawningBulldozerProstoy.MoveTransport(DirectionType.Up); break; case "buttonDown": result = - _drawningBulldozer.MoveTransport(DirectionType1.Down); + _drawningBulldozerProstoy.MoveTransport(DirectionType.Down); break; case "buttonLeft": result = - _drawningBulldozer.MoveTransport(DirectionType1.Left); + _drawningBulldozerProstoy.MoveTransport(DirectionType.Left); break; case "buttonRight": result = - _drawningBulldozer.MoveTransport(DirectionType1.Right); + _drawningBulldozerProstoy.MoveTransport(DirectionType.Right); break; } if (result) @@ -94,6 +122,6 @@ namespace ProjectBulldozer } } - + } } -- 2.25.1 From 065c718be88a8c7f09f8f7156532e9de349d1e4a Mon Sep 17 00:00:00 2001 From: mara-1 <147929076+mara-1@users.noreply.github.com> Date: Tue, 12 Mar 2024 18:33:09 +0400 Subject: [PATCH 2/4] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=81=D1=82=D1=80=D0=B0=D1=82=D0=B5=D0=B3?= =?UTF-8?q?=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs index 5aa2a3d..f2caaea 100644 --- a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs +++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs @@ -7,7 +7,6 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; -using ProjectBulldozer.Drawnings; namespace ProjectBulldozer { -- 2.25.1 From 777a09e683ddd7396ae9002d470cc02a557b43d9 Mon Sep 17 00:00:00 2001 From: mara-1 <147929076+mara-1@users.noreply.github.com> Date: Thu, 14 Mar 2024 10:07:30 +0400 Subject: [PATCH 3/4] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BE=D1=80=D0=B4=D0=B8?= =?UTF-8?q?=D0=BD=D0=B0=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectBulldozer/Drawnings/DrawingBulldozer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs index 05f54f3..de740ad 100644 --- a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs +++ b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs @@ -25,6 +25,8 @@ public class DrawningBulldozer : DrawningBulldozerProstoy EntityBulldozerProstoy = new EntityBulldozer(speed, weight, bodyColor, additionalColor, additionalOtval, additionalRihl); } + + public override void DrawTransport(Graphics g) { if (EntityBulldozerProstoy == null || EntityBulldozerProstoy is not EntityBulldozer Bulldozer || !_startPosX.HasValue || !_startPosY.HasValue) @@ -37,14 +39,12 @@ public class DrawningBulldozer : DrawningBulldozerProstoy Brush bodyBrush2 = new SolidBrush(Bulldozer.AdditionalColor); - + _startPosX += 10; - _startPosY += 5; base.DrawTransport(g); _startPosX -= 10; - _startPosY -= 5; Brush bl = new SolidBrush(Bulldozer.AdditionalColor); /////////отвал -- 2.25.1 From 1ec89cfff1ed1f3a76a484a6ef956965f211f891 Mon Sep 17 00:00:00 2001 From: mara-1 <147929076+mara-1@users.noreply.github.com> Date: Tue, 26 Mar 2024 19:46:02 +0400 Subject: [PATCH 4/4] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BE=D1=88=D0=B8=D0=B1=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Drawnings/DirectionType.cs | 31 ----------------- .../Drawnings/DrawingBulldozer.cs | 6 ++-- .../Drawnings/DrawningBulldozerProstoy.cs | 34 +++++++++---------- .../Entities/EntityBulldozer.cs | 2 +- ...ozerProstoy.cs => EntityTrackedMachine.cs} | 4 +-- .../FormBulldozer.Designer.cs | 1 + .../ProjectBulldozer/FormBulldozer.cs | 13 +++---- .../MovementStrategy/MoveableBulldozer.cs | 10 +++--- 8 files changed, 34 insertions(+), 67 deletions(-) delete mode 100644 ProjectBulldozer/ProjectBulldozer/Drawnings/DirectionType.cs rename ProjectBulldozer/ProjectBulldozer/Entities/{EntityBulldozerProstoy.cs => EntityTrackedMachine.cs} (89%) diff --git a/ProjectBulldozer/ProjectBulldozer/Drawnings/DirectionType.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DirectionType.cs deleted file mode 100644 index 4e1d045..0000000 --- a/ProjectBulldozer/ProjectBulldozer/Drawnings/DirectionType.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace ProjectBulldozer.Drawnings; - -/// -/// Направление перемещения -/// -public enum DirectionType1 -{ - /// - /// Неизвестное направление - /// - Unknow = -1, - /// - /// Вверх - /// - Up = 1, - /// - /// Вниз - /// - Down = 2, - /// - /// Влево - /// - Left = 3, - /// - /// Вправо - /// - Right = 4 -} - - -//сделано \ No newline at end of file diff --git a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs index de740ad..79f0a78 100644 --- a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs +++ b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawingBulldozer.cs @@ -6,7 +6,7 @@ namespace ProjectBulldozer.Drawnings; /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// -public class DrawningBulldozer : DrawningBulldozerProstoy +public class DrawningBulldozer : DrawningTrackedMachine { /// @@ -22,14 +22,14 @@ public class DrawningBulldozer : DrawningBulldozerProstoy public DrawningBulldozer(int speed, double weight, Color bodyColor, Color additionalColor, bool additionalOtval, bool additionalRihl, bool v) : base(180, 140) { - EntityBulldozerProstoy = new EntityBulldozer(speed, weight, bodyColor, additionalColor, additionalOtval, + EntityTrackedMachine = new EntityBulldozer(speed, weight, bodyColor, additionalColor, additionalOtval, additionalRihl); } public override void DrawTransport(Graphics g) { - if (EntityBulldozerProstoy == null || EntityBulldozerProstoy is not EntityBulldozer Bulldozer || !_startPosX.HasValue || !_startPosY.HasValue) + if (EntityTrackedMachine == null || EntityTrackedMachine is not EntityBulldozer Bulldozer || !_startPosX.HasValue || !_startPosY.HasValue) { return; } diff --git a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozerProstoy.cs b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozerProstoy.cs index b0cb10b..e563f4c 100644 --- a/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozerProstoy.cs +++ b/ProjectBulldozer/ProjectBulldozer/Drawnings/DrawningBulldozerProstoy.cs @@ -7,12 +7,12 @@ using System.Threading.Tasks; namespace ProjectBulldozer.Drawnings; -public class DrawningBulldozerProstoy +public class DrawningTrackedMachine { /// /// Класс-сущность /// - public EntityBulldozerProstoy? EntityBulldozerProstoy { get; protected set; } + public EntityTrackedMachine? EntityTrackedMachine { get; protected set; } /// /// Ширина окна /// @@ -60,7 +60,7 @@ public class DrawningBulldozerProstoy /// /// Пустой конструктор /// - private DrawningBulldozerProstoy() + private DrawningTrackedMachine() { _pictureWidth = null; _pictureHeight = null; @@ -74,9 +74,9 @@ public class DrawningBulldozerProstoy /// Скорость /// Вес /// Основной цвет - public DrawningBulldozerProstoy(int speed, double weight, Color bodyColor) : this() + public DrawningTrackedMachine(int speed, double weight, Color bodyColor) : this() { - EntityBulldozerProstoy = new EntityBulldozerProstoy(speed, weight, bodyColor); + EntityTrackedMachine = new EntityTrackedMachine(speed, weight, bodyColor); _pictureWidth = null; _pictureHeight = null; _startPosX = null; @@ -89,7 +89,7 @@ public class DrawningBulldozerProstoy /// /// Ширина прорисовки бульдозера /// Высота прорисовки бульдозера - protected DrawningBulldozerProstoy(int BulldozerWidth, int BulldozerHeight) : this() + protected DrawningTrackedMachine(int BulldozerWidth, int BulldozerHeight) : this() { _BulldozerWidth = BulldozerWidth; _BulldozerHeight = BulldozerHeight; @@ -148,7 +148,7 @@ public class DrawningBulldozerProstoy public bool MoveTransport(DirectionType direction) { - if (EntityBulldozerProstoy == null || !_startPosX.HasValue || + if (EntityTrackedMachine == null || !_startPosX.HasValue || !_startPosY.HasValue) { return false; @@ -157,33 +157,33 @@ public class DrawningBulldozerProstoy { //влево case DirectionType.Left: - if (_startPosX.Value - EntityBulldozerProstoy.Step > 0) + if (_startPosX.Value - EntityTrackedMachine.Step > 0) { - _startPosX -= (int)EntityBulldozerProstoy.Step; + _startPosX -= (int)EntityTrackedMachine.Step; } return true; //вверх case DirectionType.Up: - if (_startPosY.Value - EntityBulldozerProstoy.Step > 0) + if (_startPosY.Value - EntityTrackedMachine.Step > 0) { - _startPosY -= (int)EntityBulldozerProstoy.Step; + _startPosY -= (int)EntityTrackedMachine.Step; } return true; // вправо case DirectionType.Right: - if (_startPosX + _BulldozerWidth + EntityBulldozerProstoy.Step < _pictureWidth) + if (_startPosX + _BulldozerWidth + EntityTrackedMachine.Step < _pictureWidth) { - _startPosX += (int)EntityBulldozerProstoy.Step; + _startPosX += (int)EntityTrackedMachine.Step; } return true; //вниз case DirectionType.Down: - if (_startPosY + _BulldozerHeight + EntityBulldozerProstoy.Step < _pictureHeight) + if (_startPosY + _BulldozerHeight + EntityTrackedMachine.Step < _pictureHeight) { - _startPosY += (int)EntityBulldozerProstoy.Step; + _startPosY += (int)EntityTrackedMachine.Step; } return true; default: @@ -197,7 +197,7 @@ public class DrawningBulldozerProstoy /// public virtual void DrawTransport(Graphics g) { - if (EntityBulldozerProstoy == null || !_startPosX.HasValue || + if (EntityTrackedMachine == null || !_startPosX.HasValue || !_startPosY.HasValue) { return; @@ -205,7 +205,7 @@ public class DrawningBulldozerProstoy Pen pen = new(Color.Black); Brush brush = new SolidBrush(Color.Black); - Brush bodyBrush = new SolidBrush(EntityBulldozerProstoy.BodyColor); + Brush bodyBrush = new SolidBrush(EntityTrackedMachine.BodyColor); //основное тело diff --git a/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs index c2be6f2..a7f7505 100644 --- a/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs +++ b/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozer.cs @@ -1,6 +1,6 @@ namespace ProjectBulldozer.Entities; -public class EntityBulldozer : EntityBulldozerProstoy +public class EntityBulldozer : EntityTrackedMachine { public EntityBulldozer(int speed, double weight, Color bodyColor) : base(speed, weight, bodyColor) { diff --git a/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozerProstoy.cs b/ProjectBulldozer/ProjectBulldozer/Entities/EntityTrackedMachine.cs similarity index 89% rename from ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozerProstoy.cs rename to ProjectBulldozer/ProjectBulldozer/Entities/EntityTrackedMachine.cs index ec67c8b..22281c1 100644 --- a/ProjectBulldozer/ProjectBulldozer/Entities/EntityBulldozerProstoy.cs +++ b/ProjectBulldozer/ProjectBulldozer/Entities/EntityTrackedMachine.cs @@ -3,7 +3,7 @@ /// /// Класс-сущность "Бульдозер простой" /// -public class EntityBulldozerProstoy +public class EntityTrackedMachine { /// /// Скорость @@ -30,7 +30,7 @@ public class EntityBulldozerProstoy /// Вес автомобиля /// Основной цвет - public EntityBulldozerProstoy(int speed, double weight, Color bodyColor) + public EntityTrackedMachine(int speed, double weight, Color bodyColor) { Speed = speed; Weight = weight; diff --git a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs index 707f787..4f1123f 100644 --- a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs +++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.Designer.cs @@ -138,6 +138,7 @@ comboBoxStrategy.Name = "comboBoxStrategy"; comboBoxStrategy.Size = new Size(143, 28); comboBoxStrategy.TabIndex = 9; + // // FormBulldozer // diff --git a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs index 05430b4..e689bfb 100644 --- a/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs +++ b/ProjectBulldozer/ProjectBulldozer/FormBulldozer.cs @@ -17,7 +17,7 @@ namespace ProjectBulldozer /// /// Поле-объект для прорисовки объекта /// - private DrawningBulldozerProstoy? _drawningBulldozerProstoy; + private DrawningTrackedMachine? _drawningBulldozerProstoy; private AbstractStrategy? _strategy; /// @@ -53,8 +53,8 @@ namespace ProjectBulldozer Random random = new(); switch (type) { - case nameof(DrawningBulldozerProstoy): - _drawningBulldozerProstoy = new DrawningBulldozerProstoy(random.Next(100, 300), random.Next(1000, 3000), + case nameof(DrawningTrackedMachine): + _drawningBulldozerProstoy = new DrawningTrackedMachine(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256))); break; case nameof(DrawningBulldozer): @@ -88,7 +88,7 @@ namespace ProjectBulldozer /// /// /// - private void buttonCreateBulldozerProstoy_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningBulldozerProstoy)); + private void buttonCreateBulldozerProstoy_Click(object sender, EventArgs e) => CreateObject(nameof(DrawningTrackedMachine)); /// /// Перемещение объекта по форме (нажатие кнопок навигации) @@ -167,9 +167,6 @@ namespace ProjectBulldozer } - private void comboBoxStrategy_SelectedIndexChanged(object sender, EventArgs e) - { - - } + } } diff --git a/ProjectBulldozer/ProjectBulldozer/MovementStrategy/MoveableBulldozer.cs b/ProjectBulldozer/ProjectBulldozer/MovementStrategy/MoveableBulldozer.cs index 9a38733..b43c161 100644 --- a/ProjectBulldozer/ProjectBulldozer/MovementStrategy/MoveableBulldozer.cs +++ b/ProjectBulldozer/ProjectBulldozer/MovementStrategy/MoveableBulldozer.cs @@ -13,12 +13,12 @@ public class MoveableBulldozer : IMoveableObject /// /// Поле-объект класса DrawningBulldozerProstoy или его наследника /// - private readonly DrawningBulldozerProstoy? _bulldozer = null; + private readonly DrawningTrackedMachine? _bulldozer = null; /// /// Конструктор /// /// Объект класса DrawningBulldozerProstoy - public MoveableBulldozer(DrawningBulldozerProstoy bulldozer) + public MoveableBulldozer(DrawningTrackedMachine bulldozer) { _bulldozer = bulldozer; } @@ -26,7 +26,7 @@ public class MoveableBulldozer : IMoveableObject { get { - if (_bulldozer == null || _bulldozer.EntityBulldozerProstoy == null || + if (_bulldozer == null || _bulldozer.EntityTrackedMachine == null || !_bulldozer.GetPosX.HasValue || !_bulldozer.GetPosY.HasValue) { return null; @@ -35,10 +35,10 @@ public class MoveableBulldozer : IMoveableObject _bulldozer.GetPosY.Value, _bulldozer.GetWidth, _bulldozer.GetHeight); } } - public int GetStep => (int)(_bulldozer?.EntityBulldozerProstoy?.Step ?? 0); + public int GetStep => (int)(_bulldozer?.EntityTrackedMachine?.Step ?? 0); public bool TryMoveObject(MovementDirection direction) { - if (_bulldozer == null || _bulldozer.EntityBulldozerProstoy == null) + if (_bulldozer == null || _bulldozer.EntityTrackedMachine == null) { return false; } -- 2.25.1