Навёл красоту, убрал пустые строки

This commit is contained in:
Ilya Ryabov 2024-02-19 14:07:50 +04:00
parent 2f4c58fbc6
commit a22e2833b2
8 changed files with 6 additions and 28 deletions

View File

@ -19,9 +19,6 @@ public class DrawingStormtrooper : DrawningBaseStormtrooper
{
EntityBaseStormtrooper = new EntityStormtrooper(speed, weight, bodyColor, additionalColor, bombs, rockets);
}
/// <summary>
/// Прорисовка объекта
/// </summary>

View File

@ -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);
}
}

View File

@ -14,7 +14,6 @@ namespace ProjectStormtrooper
private DrawningBaseStormtrooper? _drawningBaseStormtrooper;
private AbstractStrategy? _strategy;
/// <summary>
/// Конструктор формы
/// </summary>
@ -23,8 +22,6 @@ namespace ProjectStormtrooper
InitializeComponent();
_strategy = null;
}
/// <summary>
/// Метод прорисовки бомбардировщика
/// </summary>
@ -40,7 +37,6 @@ namespace ProjectStormtrooper
_drawningBaseStormtrooper.DrawTransport(gr);
pictureBoxStormtrooper.Image = bmp;
}
/// <summary>
/// Создание объекта класса-перемещения
/// </summary>
@ -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));
}
/// <summary>
/// Перемещение объекта по форме (нажатие кнопок навигации)
/// </summary>
@ -92,7 +86,6 @@ namespace ProjectStormtrooper
/// <param name="e"></param>
private void ButtonMove_Click(object sender, EventArgs e)
{
if (_drawningBaseStormtrooper == null)
{
return;
@ -162,5 +155,4 @@ namespace ProjectStormtrooper
}
}
}
}

View File

@ -1,6 +1,5 @@
namespace ProjectStormtrooper.MovementStrategy;
/// <summary>
/// Класс-стратегия перемещения объекта
/// </summary>
@ -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;
}
}

View File

@ -1,5 +1,7 @@
namespace ProjectStormtrooper.MovementStrategy;
/// <summary>
/// Стратегия перемещения объекта в правый нижний угол
/// </summary>
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;

View File

@ -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())
{

View File

@ -1,5 +1,4 @@

namespace ProjectStormtrooper.MovementStrategy;
namespace ProjectStormtrooper.MovementStrategy;
/// <summary>
/// Направление перемещения
/// </summary>

View File

@ -1,5 +1,4 @@

namespace ProjectStormtrooper.MovementStrategy;
namespace ProjectStormtrooper.MovementStrategy;
public enum StrategyStatus
{