From 8cd9bd77c14757304d2d99d01549a278841fcba3 Mon Sep 17 00:00:00 2001 From: malimova Date: Sat, 7 Oct 2023 09:06:57 +0400 Subject: [PATCH] =?UTF-8?q?=D0=98=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=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=BE?= =?UTF-8?q?=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirBomber/AirBomber/DrawningAirPlane.cs | 38 ------------------- AirBomber/AirBomber/DrawningObjectAirPlane.cs | 2 +- AirBomber/AirBomber/FormAirBomber.Designer.cs | 2 +- AirBomber/AirBomber/FormAirBomber.cs | 8 ++-- AirBomber/AirBomber/IMoveableObject.cs | 1 - AirBomber/AirBomber/MoveToBorder.cs | 1 - 6 files changed, 6 insertions(+), 46 deletions(-) diff --git a/AirBomber/AirBomber/DrawningAirPlane.cs b/AirBomber/AirBomber/DrawningAirPlane.cs index 64dce49..3d6d33a 100644 --- a/AirBomber/AirBomber/DrawningAirPlane.cs +++ b/AirBomber/AirBomber/DrawningAirPlane.cs @@ -88,44 +88,6 @@ namespace AirBomber /// Изменение направления перемещения /// /// Направление - public void MoveTransport(DirectionType direction) - { - if (EntityAirPlane == null) - { - return; - } - switch (direction) - { - //влево - case DirectionType.Left: - if (_startPosX - EntityAirPlane.Step > 0) - { - _startPosX -= (int)EntityAirPlane.Step; - } - break; - //вверх - case DirectionType.Up: - if (_startPosY - EntityAirPlane.Step > 0) - { - _startPosY -= (int)EntityAirPlane.Step; - } - break; - // вправо - case DirectionType.Right: - if (_startPosX + EntityAirPlane.Step + _airPlaneWidth < _pictureWidth) - { - _startPosX += (int)EntityAirPlane.Step; - } - break; - //вниз - case DirectionType.Down: - if (_startPosY + EntityAirPlane.Step + _airPlaneHeight < _pictureHeight) - { - _startPosY += (int)EntityAirPlane.Step; - } - break; - } - } /// /// Прорисовка объекта /// diff --git a/AirBomber/AirBomber/DrawningObjectAirPlane.cs b/AirBomber/AirBomber/DrawningObjectAirPlane.cs index fe16e4a..bce8cdb 100644 --- a/AirBomber/AirBomber/DrawningObjectAirPlane.cs +++ b/AirBomber/AirBomber/DrawningObjectAirPlane.cs @@ -30,6 +30,6 @@ namespace AirBomber public bool CheckCanMove(DirectionType direction) => _drawningAirPlane?.CanMove(direction) ?? false; public void MoveObject(DirectionType direction) => - _drawningAirPlane?.MoveTransport(direction); + _drawningAirPlane?.MovePlane(direction); } } diff --git a/AirBomber/AirBomber/FormAirBomber.Designer.cs b/AirBomber/AirBomber/FormAirBomber.Designer.cs index 637d4fb..7dd0993 100644 --- a/AirBomber/AirBomber/FormAirBomber.Designer.cs +++ b/AirBomber/AirBomber/FormAirBomber.Designer.cs @@ -114,7 +114,7 @@ comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right; comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList; comboBoxStrategy.FormattingEnabled = true; - comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToRightEdge" }); + comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToBorder" }); comboBoxStrategy.Location = new Point(755, 26); comboBoxStrategy.Name = "comboBoxStrategy"; comboBoxStrategy.Size = new Size(219, 33); diff --git a/AirBomber/AirBomber/FormAirBomber.cs b/AirBomber/AirBomber/FormAirBomber.cs index 45f158b..aa7e5ba 100644 --- a/AirBomber/AirBomber/FormAirBomber.cs +++ b/AirBomber/AirBomber/FormAirBomber.cs @@ -55,16 +55,16 @@ switch (name) { case "buttonUp": - _drawningAirPlane.MoveTransport(DirectionType.Up); + _drawningAirPlane.MovePlane(DirectionType.Up); break; case "buttonDown": - _drawningAirPlane.MoveTransport(DirectionType.Down); + _drawningAirPlane.MovePlane(DirectionType.Down); break; case "buttonLeft": - _drawningAirPlane.MoveTransport(DirectionType.Left); + _drawningAirPlane.MovePlane(DirectionType.Left); break; case "buttonRight": - _drawningAirPlane.MoveTransport(DirectionType.Right); + _drawningAirPlane.MovePlane(DirectionType.Right); break; } Draw(); diff --git a/AirBomber/AirBomber/IMoveableObject.cs b/AirBomber/AirBomber/IMoveableObject.cs index 92a08fc..2c271c2 100644 --- a/AirBomber/AirBomber/IMoveableObject.cs +++ b/AirBomber/AirBomber/IMoveableObject.cs @@ -27,6 +27,5 @@ namespace AirBomber /// /// Направление void MoveObject(DirectionType direction); - } } diff --git a/AirBomber/AirBomber/MoveToBorder.cs b/AirBomber/AirBomber/MoveToBorder.cs index 435ab8d..b6bb968 100644 --- a/AirBomber/AirBomber/MoveToBorder.cs +++ b/AirBomber/AirBomber/MoveToBorder.cs @@ -21,7 +21,6 @@ namespace AirBomber var objParams = GetObjectParameters; if (objParams == null) return; if (objParams.RightBorder < FieldWidth - GetStep()) MoveRight(); - } } }