Compare commits
No commits in common. "fd17593df5bb84de4ca742b625b44ed2ae9a3c68" and "21f5c7ac1be9e54f85d3911511080fcac57f5e49" have entirely different histories.
fd17593df5
...
21f5c7ac1b
@ -22,7 +22,7 @@ namespace AirBomber
|
|||||||
/// <param name="width">Ширина картинки</param>
|
/// <param name="width">Ширина картинки</param>
|
||||||
/// <param name="height">Высота картинки</param>
|
/// <param name="height">Высота картинки</param>
|
||||||
public DrawningAirBomber(int speed, double weight, Color bodyColor, Color
|
public DrawningAirBomber(int speed, double weight, Color bodyColor, Color
|
||||||
additionalColor, bool bombs, Color bombsColor, bool fuelTanks, int width, int height) :
|
additionalColor, bool bombs, Color bombsColor, bool fuelTanks, int width, int height) :
|
||||||
|
|
||||||
base(speed, weight, bodyColor, width, height, 160, 118)
|
base(speed, weight, bodyColor, width, height, 160, 118)
|
||||||
{
|
{
|
||||||
@ -42,12 +42,14 @@ namespace AirBomber
|
|||||||
Brush bombsColor = new SolidBrush(airBomber.BombsColor);
|
Brush bombsColor = new SolidBrush(airBomber.BombsColor);
|
||||||
base.DrawPlane(g);
|
base.DrawPlane(g);
|
||||||
// обвесы
|
// обвесы
|
||||||
|
|
||||||
g.FillEllipse(bombsColor, _startPosX + 90, _startPosY + 20, 15, 29);
|
g.FillEllipse(bombsColor, _startPosX + 90, _startPosY + 20, 15, 29);
|
||||||
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 20, 15, 29);
|
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 20, 15, 29);
|
||||||
g.FillEllipse(bombsColor, _startPosX + 90, _startPosY + 70, 15, 29);
|
g.FillEllipse(bombsColor, _startPosX + 90, _startPosY + 70, 15, 29);
|
||||||
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 70, 15, 29);
|
g.DrawEllipse(pen, _startPosX + 90, _startPosY + 70, 15, 29);
|
||||||
g.FillEllipse(bombsColor, _startPosX + 140, _startPosY + 50, 15, 15);
|
g.FillEllipse(bombsColor, _startPosX + 140, _startPosY + 50, 15, 15);
|
||||||
g.DrawEllipse(pen, _startPosX + 140, _startPosY + 50, 15, 15);
|
g.DrawEllipse(pen, _startPosX + 140, _startPosY + 50, 15, 15);
|
||||||
|
|
||||||
// fueltanks
|
// fueltanks
|
||||||
g.FillRectangle(additionalBrush, _startPosX + 63, _startPosY + 34, 20, 15);
|
g.FillRectangle(additionalBrush, _startPosX + 63, _startPosY + 34, 20, 15);
|
||||||
g.DrawRectangle(pen, _startPosX + 63, _startPosY + 34, 20, 15);
|
g.DrawRectangle(pen, _startPosX + 63, _startPosY + 34, 20, 15);
|
||||||
|
@ -81,14 +81,6 @@ namespace AirBomber
|
|||||||
public void SetPosition(int x, int y)
|
public void SetPosition(int x, int y)
|
||||||
{
|
{
|
||||||
// TODO: Изменение x, y, если при установке объект выходит за границы
|
// TODO: Изменение x, y, если при установке объект выходит за границы
|
||||||
if (x < 0 || x + _airPlaneWidth > _pictureWidth)
|
|
||||||
{
|
|
||||||
x = _pictureWidth - _airPlaneWidth;
|
|
||||||
}
|
|
||||||
if (y < 0 || y + _airPlaneHeight > _pictureHeight)
|
|
||||||
{
|
|
||||||
y = _pictureHeight - _airPlaneHeight;
|
|
||||||
}
|
|
||||||
_startPosX = x;
|
_startPosX = x;
|
||||||
_startPosY = y;
|
_startPosY = y;
|
||||||
}
|
}
|
||||||
@ -96,6 +88,44 @@ 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>
|
||||||
@ -225,9 +255,9 @@ namespace AirBomber
|
|||||||
//вверх
|
//вверх
|
||||||
DirectionType.Up => _startPosY - EntityAirPlane.Step > 0,
|
DirectionType.Up => _startPosY - EntityAirPlane.Step > 0,
|
||||||
// вправо
|
// вправо
|
||||||
DirectionType.Right => _startPosX + EntityAirPlane.Step + _airPlaneWidth < _pictureWidth,
|
DirectionType.Right => _startPosX + EntityAirPlane.Step < _pictureWidth,
|
||||||
//вниз
|
//вниз
|
||||||
DirectionType.Down => _startPosY + EntityAirPlane.Step + _airPlaneHeight < _pictureHeight,
|
DirectionType.Down => _startPosY + EntityAirPlane.Step < _pictureHeight,
|
||||||
_ => false,
|
_ => false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -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?.MovePlane(direction);
|
_drawningAirPlane?.MoveTransport(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", "MoveToBorder" });
|
comboBoxStrategy.Items.AddRange(new object[] { "MoveToCenter", "MoveToRightEdge" });
|
||||||
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.MovePlane(DirectionType.Up);
|
_drawningAirPlane.MoveTransport(DirectionType.Up);
|
||||||
break;
|
break;
|
||||||
case "buttonDown":
|
case "buttonDown":
|
||||||
_drawningAirPlane.MovePlane(DirectionType.Down);
|
_drawningAirPlane.MoveTransport(DirectionType.Down);
|
||||||
break;
|
break;
|
||||||
case "buttonLeft":
|
case "buttonLeft":
|
||||||
_drawningAirPlane.MovePlane(DirectionType.Left);
|
_drawningAirPlane.MoveTransport(DirectionType.Left);
|
||||||
break;
|
break;
|
||||||
case "buttonRight":
|
case "buttonRight":
|
||||||
_drawningAirPlane.MovePlane(DirectionType.Right);
|
_drawningAirPlane.MoveTransport(DirectionType.Right);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Draw();
|
Draw();
|
||||||
|
@ -27,5 +27,6 @@ namespace AirBomber
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="direction">Направление</param>
|
/// <param name="direction">Направление</param>
|
||||||
void MoveObject(DirectionType direction);
|
void MoveObject(DirectionType direction);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ 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();
|
||||||
if (objParams.DownBorder < FieldHeight - GetStep()) MoveDown();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user