From 8f8380b98685408f73d2856c557eef7a0db3c525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=BE=D1=84=D1=8C=D1=8F=20=D0=AF=D0=BA=D0=BE=D0=B1?= =?UTF-8?q?=D1=87=D1=83=D0=BA?= Date: Tue, 28 Nov 2023 00:56:29 +0400 Subject: [PATCH] =?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=D0=BD=D0=BE=D0=B2=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D1=81=D0=B2=D0=BE=D0=B9=D1=81=D1=82=D0=B2=D0=B0=20=D0=BA=D0=BB?= =?UTF-8?q?=D0=B0=D1=81=D1=81=D0=B0=20DrawningBoat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sailboat/Sailboat/DrawingBoat.cs | 44 -------------------------------- 1 file changed, 44 deletions(-) diff --git a/Sailboat/Sailboat/DrawingBoat.cs b/Sailboat/Sailboat/DrawingBoat.cs index 7fd02a7..a476002 100644 --- a/Sailboat/Sailboat/DrawingBoat.cs +++ b/Sailboat/Sailboat/DrawingBoat.cs @@ -28,14 +28,6 @@ namespace Sailboat.DrawingObjects public IMoveableObject GetMoveableObject => new DrawingObjectBoat(this); - /// - /// Конструктор - /// - /// Скорость - /// Вес - /// Основной цвет - /// Ширина картинки - /// Высота картинки public DrawingBoat(int speed, double weight, Color bodyColor, int width, int height) { if (width < _boatWidth || height < _boatHeight) @@ -47,16 +39,6 @@ namespace Sailboat.DrawingObjects EntityBoat = new EntityBoat(speed, weight, bodyColor); } - /// - /// Конструктор - /// - /// Скорость - /// Вес - /// Основной цвет - /// Ширина картинки - /// Высота картинки - /// Ширина прорисовки лодки - /// Высота прорисовки лодки protected DrawingBoat(int speed, double weight, Color bodyColor, int width, int height, int boatWidth, int boatHeight) { if (width < _boatWidth || height < _boatHeight) @@ -70,11 +52,6 @@ namespace Sailboat.DrawingObjects EntityBoat = new EntityBoat(speed, weight, bodyColor); } - /// - /// Установка позиции - /// - /// Координата X - /// Координата Y public void SetPosition(int x, int y) { if (x < 0 || x + _boatWidth > _pictureWidth) @@ -89,11 +66,6 @@ namespace Sailboat.DrawingObjects _startPosY = y; } - /// - /// Проверка, что объект может переместится по указанному направлению - /// - /// Направление - /// true - можно переместится по указанному направлению public bool CanMove(DirectionType direction) { if (EntityBoat == null) @@ -102,22 +74,14 @@ namespace Sailboat.DrawingObjects } return direction switch { - //влево DirectionType.Left => _startPosX - EntityBoat.Step > 0, - //вверх DirectionType.Up => _startPosY - EntityBoat.Step > 0, - // вправо DirectionType.Right => _startPosX + EntityBoat.Step < _pictureWidth, - //вниз DirectionType.Down => _startPosY + EntityBoat.Step < _pictureHeight, _ => false }; } - /// - /// Изменение направления перемещения - /// - /// Направление public void MoveTransport(DirectionType direction) { if (!CanMove(direction) || EntityBoat == null) @@ -126,28 +90,24 @@ namespace Sailboat.DrawingObjects } switch (direction) { - //влево case DirectionType.Left: if (_startPosX - EntityBoat.Step > 0) { _startPosX -= (int)EntityBoat.Step; } break; - //вверх case DirectionType.Up: if (_startPosY - EntityBoat.Step > 0) { _startPosY -= (int)EntityBoat.Step; } break; - //вправо case DirectionType.Right: if (_startPosX + EntityBoat.Step + _boatWidth < _pictureWidth) { _startPosX += (int)EntityBoat.Step; } break; - //вниз case DirectionType.Down: if (_startPosY + EntityBoat.Step + _boatHeight < _pictureHeight) { @@ -157,10 +117,6 @@ namespace Sailboat.DrawingObjects } } - /// - /// Прорисовка объекта - /// - /// public virtual void DrawTransport(Graphics g) { if (EntityBoat == null)