diff --git a/ProjectStormtrooper/ProjectStormtrooper/Drawnings/DrawingStormtrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/Drawnings/DrawingStormtrooper.cs index edd944e..d8c1982 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/Drawnings/DrawingStormtrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/Drawnings/DrawingStormtrooper.cs @@ -19,9 +19,6 @@ public class DrawingStormtrooper : DrawningBaseStormtrooper { EntityBaseStormtrooper = new EntityStormtrooper(speed, weight, bodyColor, additionalColor, bombs, rockets); } - - - /// /// Прорисовка объекта /// diff --git a/ProjectStormtrooper/ProjectStormtrooper/Drawnings/DrawningBaseStormtrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/Drawnings/DrawningBaseStormtrooper.cs index 5aaf5b3..c6d6575 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/Drawnings/DrawningBaseStormtrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/Drawnings/DrawningBaseStormtrooper.cs @@ -1,5 +1,4 @@ using ProjectStormtrooper.Entities; - namespace ProjectStormtrooper.Drawnings; public class DrawningBaseStormtrooper @@ -222,7 +221,6 @@ public class DrawningBaseStormtrooper } Pen pen = new(Color.Black); Brush bodyColorBrush = new SolidBrush(EntityBaseStormtrooper.BodyColor); - //Тело бомбардировщика g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 60, 120, 20); //Задние крылья бомбардировщика @@ -244,7 +242,6 @@ public class DrawningBaseStormtrooper Nose[1].X = _startPosX.Value; Nose[1].Y = _startPosY.Value + 70; Nose[2].X = _startPosX.Value + 20; Nose[2].Y = _startPosY.Value + 60; g.FillPolygon(bodyColorBrush, Nose); - } } diff --git a/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs index d138b22..c1bda8f 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/FormStormtrooper.cs @@ -14,7 +14,6 @@ namespace ProjectStormtrooper private DrawningBaseStormtrooper? _drawningBaseStormtrooper; private AbstractStrategy? _strategy; - /// /// Конструктор формы /// @@ -23,8 +22,6 @@ namespace ProjectStormtrooper InitializeComponent(); _strategy = null; } - - /// /// Метод прорисовки бомбардировщика /// @@ -40,7 +37,6 @@ namespace ProjectStormtrooper _drawningBaseStormtrooper.DrawTransport(gr); pictureBoxStormtrooper.Image = bmp; } - /// /// Создание объекта класса-перемещения /// @@ -63,7 +59,6 @@ namespace ProjectStormtrooper default: return; } - _drawningBaseStormtrooper.SetPictureSize(pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height); _drawningBaseStormtrooper.SetPosition(random.Next(10, 100), random.Next(10, 100)); _strategy = null; @@ -84,7 +79,6 @@ namespace ProjectStormtrooper { CreateObject(nameof(DrawningBaseStormtrooper)); } - /// /// Перемещение объекта по форме (нажатие кнопок навигации) /// @@ -92,7 +86,6 @@ namespace ProjectStormtrooper /// private void ButtonMove_Click(object sender, EventArgs e) { - if (_drawningBaseStormtrooper == null) { return; @@ -162,5 +155,4 @@ namespace ProjectStormtrooper } } } - } diff --git a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/AbstractStrategy.cs b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/AbstractStrategy.cs index 04507a6..cba80d2 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/AbstractStrategy.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/AbstractStrategy.cs @@ -1,6 +1,5 @@ namespace ProjectStormtrooper.MovementStrategy; - /// /// Класс-стратегия перемещения объекта /// @@ -44,7 +43,6 @@ public abstract class AbstractStrategy _state = StrategyStatus.NotInit; return; } - _state = StrategyStatus.InProgress; _moveableObject = moveableObject; FieldWidth = width; @@ -60,13 +58,11 @@ public abstract class AbstractStrategy { return; } - if (IsTargetDestinaion()) { _state = StrategyStatus.Finish; return; } - MoveToTarget(); } @@ -134,7 +130,6 @@ public abstract class AbstractStrategy { return false; } - return _moveableObject?.TryMoveObject(movementDirection) ?? false; } } \ No newline at end of file diff --git a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MoveToBorder.cs b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MoveToBorder.cs index d13a51d..0e18375 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MoveToBorder.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MoveToBorder.cs @@ -1,5 +1,7 @@ namespace ProjectStormtrooper.MovementStrategy; - +/// +/// Стратегия перемещения объекта в правый нижний угол +/// public class MoveToBorder : AbstractStrategy { protected override bool IsTargetDestinaion() @@ -14,7 +16,6 @@ public class MoveToBorder : AbstractStrategy objParams.TopBorder - GetStep() <= 0 || objParams.ObjectMiddleVertical + GetStep() >= FieldHeight; } - protected override void MoveToTarget() { ObjectParameters? objParams = GetObjectParameters; @@ -22,7 +23,6 @@ public class MoveToBorder : AbstractStrategy { return; } - //реализация в правый нижний угол int x = objParams.RightBorder; if (x + GetStep() < FieldWidth) MoveRight(); int y = objParams.DownBorder; diff --git a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MoveToCenter.cs b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MoveToCenter.cs index 8d996b6..5c06695 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MoveToCenter.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MoveToCenter.cs @@ -15,7 +15,6 @@ public class MoveToCenter : AbstractStrategy return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; } - protected override void MoveToTarget() { ObjectParameters? objParams = GetObjectParameters; @@ -36,7 +35,7 @@ public class MoveToCenter : AbstractStrategy MoveRight(); } } - + int diffY = objParams.ObjectMiddleVertical - FieldHeight / 2; if (Math.Abs(diffY) > GetStep()) { diff --git a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MovementDirection.cs b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MovementDirection.cs index 2124b25..ca78f1d 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MovementDirection.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/MovementDirection.cs @@ -1,5 +1,4 @@ - -namespace ProjectStormtrooper.MovementStrategy; +namespace ProjectStormtrooper.MovementStrategy; /// /// Направление перемещения /// diff --git a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/StrategyStatus.cs b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/StrategyStatus.cs index 725fb1d..f4464ec 100644 --- a/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/StrategyStatus.cs +++ b/ProjectStormtrooper/ProjectStormtrooper/MovementStrategy/StrategyStatus.cs @@ -1,5 +1,4 @@ - -namespace ProjectStormtrooper.MovementStrategy; +namespace ProjectStormtrooper.MovementStrategy; public enum StrategyStatus {