From 083ffec901b47ea5cef42084ed3ba394ffa9db9a Mon Sep 17 00:00:00 2001 From: platoff aeeee Date: Tue, 10 Oct 2023 23:57:24 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B8=202=D0=BB?= =?UTF-8?q?=D0=B0=D0=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Tank/Tank/AbstractStrategy.cs | 11 ----------- Tank/Tank/Direction.cs | 15 --------------- Tank/Tank/DrawingArmoredCar.cs | 1 + Tank/Tank/DrawingObjectArmoredCar.cs | 3 +-- Tank/Tank/DrawingTank.cs | 4 +--- Tank/Tank/EntityArmoredCar.cs | 1 + Tank/Tank/EntityTank.cs | 2 +- Tank/Tank/FormTank.cs | 2 +- Tank/Tank/IMoveableObject.cs | 1 + Tank/Tank/MoveToBorder.cs | 1 + Tank/Tank/MoveToCenter.cs | 1 + Tank/Tank/ObjectParameters.cs | 2 +- Tank/Tank/Status.cs | 2 +- 13 files changed, 11 insertions(+), 35 deletions(-) diff --git a/Tank/Tank/AbstractStrategy.cs b/Tank/Tank/AbstractStrategy.cs index b5acb9c..81443dd 100644 --- a/Tank/Tank/AbstractStrategy.cs +++ b/Tank/Tank/AbstractStrategy.cs @@ -6,27 +6,16 @@ using System.Threading.Tasks; namespace Tank.MovementStrategy { - /// /// Класс-стратегия перемещения объекта - /// public abstract class AbstractStrategy { - /// /// Перемещаемый объект - /// private IMoveableObject? _moveableObject; - /// /// Статус перемещения - /// private Status _state = Status.NotInit; - - /// /// Ширина поля - /// protected int FieldWidth { get; private set; } - /// /// Высота поля - /// protected int FieldHeight { get; private set; } /// /// Статус перемещения diff --git a/Tank/Tank/Direction.cs b/Tank/Tank/Direction.cs index 96e9c9f..7a433fe 100644 --- a/Tank/Tank/Direction.cs +++ b/Tank/Tank/Direction.cs @@ -6,27 +6,12 @@ using System.Threading.Tasks; namespace Tank { - /// /// Направление перемещения - /// public enum Direction { - /// - /// Вверх - /// - /// Up = 1, - /// - /// Вниз - /// Down = 2, - /// - /// Влево - /// Left = 3, - /// - /// Вправо - /// Right = 4 } } diff --git a/Tank/Tank/DrawingArmoredCar.cs b/Tank/Tank/DrawingArmoredCar.cs index 3e53db0..fd37161 100644 --- a/Tank/Tank/DrawingArmoredCar.cs +++ b/Tank/Tank/DrawingArmoredCar.cs @@ -21,6 +21,7 @@ namespace Tank.DrawingObjects public int GetWidth => _ArmoredcarWidth; /// Высота объекта public int GetHeight => _ArmoredcarHeight; + /// Ширина окна private int _pictureWidth; /// Высота окна diff --git a/Tank/Tank/DrawingObjectArmoredCar.cs b/Tank/Tank/DrawingObjectArmoredCar.cs index 457a477..acdff3a 100644 --- a/Tank/Tank/DrawingObjectArmoredCar.cs +++ b/Tank/Tank/DrawingObjectArmoredCar.cs @@ -7,8 +7,7 @@ using Tank.DrawingObjects; namespace Tank.MovementStrategy { - /// Реализация интерфейса IDrawningObject для работы с объектом DrawningCar - /// (паттерн Adapter) + /// Реализация интерфейса IDrawningObject для работы с объектом DrawningCar (паттерн Adapter) public class DrawningObjectArmoredCar : IMoveableObject { private readonly DrawingArmoredCar? _drawningArmoredCar = null; diff --git a/Tank/Tank/DrawingTank.cs b/Tank/Tank/DrawingTank.cs index 08311c2..9f70afc 100644 --- a/Tank/Tank/DrawingTank.cs +++ b/Tank/Tank/DrawingTank.cs @@ -77,7 +77,7 @@ namespace Tank.DrawingObjects g.FillEllipse(brBlack, _startPosX + 55, _startPosY + 32, 10, 10); g.FillEllipse(brBlack, _startPosX + 75, _startPosY + 32, 10, 10); - //кузов + //кузов Brush br = new SolidBrush(ArmoredCar.BodyColor); g.FillRectangle(br, _startPosX + 5, _startPosY + 17, 110, 18); g.FillRectangle(br, _startPosX + 30, _startPosY, 50, 15); @@ -162,9 +162,7 @@ namespace Tank.DrawingObjects //} ///// - /// /// Прорисовка объекта - /// /// //public void DrawTransport(Graphics g) //{ diff --git a/Tank/Tank/EntityArmoredCar.cs b/Tank/Tank/EntityArmoredCar.cs index 81a0640..88fa08f 100644 --- a/Tank/Tank/EntityArmoredCar.cs +++ b/Tank/Tank/EntityArmoredCar.cs @@ -28,5 +28,6 @@ namespace Tank.Entites BodyColor = bodyColor; } + } } diff --git a/Tank/Tank/EntityTank.cs b/Tank/Tank/EntityTank.cs index fbe4cd4..da36f4d 100644 --- a/Tank/Tank/EntityTank.cs +++ b/Tank/Tank/EntityTank.cs @@ -22,7 +22,7 @@ namespace Tank.Entites public bool Trunk { get; private set; } // Признак (опция) наличия гоночной полосы public bool SportLine { get; private set; } - // Шаг перемещения танка + /// Шаг перемещения танка // public double Step => (double)Speed * 200 / Weight; /// Инициализация полей объекта-класса спортивного автомобиля /// Скорость diff --git a/Tank/Tank/FormTank.cs b/Tank/Tank/FormTank.cs index b18af0a..73856bb 100644 --- a/Tank/Tank/FormTank.cs +++ b/Tank/Tank/FormTank.cs @@ -115,7 +115,7 @@ namespace Tank _ => null, }; if (_abstractStrategy == null) - { + { return; } _abstractStrategy.SetData(new diff --git a/Tank/Tank/IMoveableObject.cs b/Tank/Tank/IMoveableObject.cs index 6155166..4c68fc1 100644 --- a/Tank/Tank/IMoveableObject.cs +++ b/Tank/Tank/IMoveableObject.cs @@ -18,5 +18,6 @@ namespace Tank.MovementStrategy bool CheckCanMove(Direction direction); /// Изменение направления пермещения объекта void MoveObject(Direction direction); + } } diff --git a/Tank/Tank/MoveToBorder.cs b/Tank/Tank/MoveToBorder.cs index 2a802d1..5f5f8e3 100644 --- a/Tank/Tank/MoveToBorder.cs +++ b/Tank/Tank/MoveToBorder.cs @@ -18,6 +18,7 @@ namespace Tank.MovementStrategy } return objParams.RightBorder + GetStep() >= FieldWidth && objParams.DownBorder + GetStep() >= FieldHeight; } + protected override void MoveToTarget() { var objParams = GetObjectParameters; diff --git a/Tank/Tank/MoveToCenter.cs b/Tank/Tank/MoveToCenter.cs index b3570c5..200b281 100644 --- a/Tank/Tank/MoveToCenter.cs +++ b/Tank/Tank/MoveToCenter.cs @@ -7,6 +7,7 @@ using System.Threading.Tasks; namespace Tank.MovementStrategy { /// Стратегия перемещения объекта в центр экрана + public class MoveToCenter : AbstractStrategy { protected override bool IsTargetDestinaion() diff --git a/Tank/Tank/ObjectParameters.cs b/Tank/Tank/ObjectParameters.cs index f277013..d15738d 100644 --- a/Tank/Tank/ObjectParameters.cs +++ b/Tank/Tank/ObjectParameters.cs @@ -25,7 +25,7 @@ namespace Tank.MovementStrategy public int ObjectMiddleHorizontal => _x + _width / 2; /// Середина объекта public int ObjectMiddleVertical => _y + _height / 2; - /// Конструктор + /// Конструктор public ObjectParameters(int x, int y, int width, int height) { _x = x; diff --git a/Tank/Tank/Status.cs b/Tank/Tank/Status.cs index fb5ca21..0b4b7a1 100644 --- a/Tank/Tank/Status.cs +++ b/Tank/Tank/Status.cs @@ -9,7 +9,7 @@ namespace Tank.MovementStrategy /// Статус выполнения операции перемещения public enum Status { - NotInit, + NotInit, InProgress, Finish