Исправление методов
This commit is contained in:
parent
21f5c7ac1b
commit
8cd9bd77c1
@ -88,44 +88,6 @@ namespace AirBomber
|
|||||||
/// Изменение направления перемещения
|
/// Изменение направления перемещения
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="direction">Направление</param>
|
/// <param name="direction">Направление</param>
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Прорисовка объекта
|
/// Прорисовка объекта
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -30,6 +30,6 @@ namespace AirBomber
|
|||||||
public bool CheckCanMove(DirectionType direction) =>
|
public bool CheckCanMove(DirectionType direction) =>
|
||||||
_drawningAirPlane?.CanMove(direction) ?? false;
|
_drawningAirPlane?.CanMove(direction) ?? false;
|
||||||
public void MoveObject(DirectionType direction) =>
|
public void MoveObject(DirectionType direction) =>
|
||||||
_drawningAirPlane?.MoveTransport(direction);
|
_drawningAirPlane?.MovePlane(direction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
AirBomber/AirBomber/FormAirBomber.Designer.cs
generated
2
AirBomber/AirBomber/FormAirBomber.Designer.cs
generated
@ -114,7 +114,7 @@
|
|||||||
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
comboBoxStrategy.Anchor = AnchorStyles.Top | AnchorStyles.Right;
|
||||||
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
comboBoxStrategy.DropDownStyle = ComboBoxStyle.DropDownList;
|
||||||
comboBoxStrategy.FormattingEnabled = true;
|
comboBoxStrategy.FormattingEnabled = true;
|
||||||
comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToRightEdge" });
|
comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToBorder" });
|
||||||
comboBoxStrategy.Location = new Point(755, 26);
|
comboBoxStrategy.Location = new Point(755, 26);
|
||||||
comboBoxStrategy.Name = "comboBoxStrategy";
|
comboBoxStrategy.Name = "comboBoxStrategy";
|
||||||
comboBoxStrategy.Size = new Size(219, 33);
|
comboBoxStrategy.Size = new Size(219, 33);
|
||||||
|
@ -55,16 +55,16 @@
|
|||||||
switch (name)
|
switch (name)
|
||||||
{
|
{
|
||||||
case "buttonUp":
|
case "buttonUp":
|
||||||
_drawningAirPlane.MoveTransport(DirectionType.Up);
|
_drawningAirPlane.MovePlane(DirectionType.Up);
|
||||||
break;
|
break;
|
||||||
case "buttonDown":
|
case "buttonDown":
|
||||||
_drawningAirPlane.MoveTransport(DirectionType.Down);
|
_drawningAirPlane.MovePlane(DirectionType.Down);
|
||||||
break;
|
break;
|
||||||
case "buttonLeft":
|
case "buttonLeft":
|
||||||
_drawningAirPlane.MoveTransport(DirectionType.Left);
|
_drawningAirPlane.MovePlane(DirectionType.Left);
|
||||||
break;
|
break;
|
||||||
case "buttonRight":
|
case "buttonRight":
|
||||||
_drawningAirPlane.MoveTransport(DirectionType.Right);
|
_drawningAirPlane.MovePlane(DirectionType.Right);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Draw();
|
Draw();
|
||||||
|
@ -27,6 +27,5 @@ namespace AirBomber
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="direction">Направление</param>
|
/// <param name="direction">Направление</param>
|
||||||
void MoveObject(DirectionType direction);
|
void MoveObject(DirectionType direction);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ namespace AirBomber
|
|||||||
var objParams = GetObjectParameters;
|
var objParams = GetObjectParameters;
|
||||||
if (objParams == null) return;
|
if (objParams == null) return;
|
||||||
if (objParams.RightBorder < FieldWidth - GetStep()) MoveRight();
|
if (objParams.RightBorder < FieldWidth - GetStep()) MoveRight();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user