LabWork_02 #3

Closed
maxnes3 wants to merge 14 commits from LabWork_02 into LabWork_01
2 changed files with 6 additions and 0 deletions
Showing only changes of commit 48a9ca1a44 - Show all commits

View File

@ -16,6 +16,7 @@ namespace WarmlyShip
private readonly int _warmlyShipWidth = 125; //Ширина отрисовки корабля
private readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля
//Конструктор класса
public DrawingWarmlyShip(int speed, float weight, Color bodyColor)
{
warmlyShip = new EntityWarmlyShip(speed, weight, bodyColor);
@ -27,6 +28,7 @@ namespace WarmlyShip
_warmlyShipHeight = warmlyHeight;
}
//Начальная позиция коробля
public void SetPosition(int x, int y, int width, int height)
{
if (width < _warmlyShipWidth || height < _warmlyShipHeight) return;
@ -37,6 +39,7 @@ namespace WarmlyShip
_pictureHeight = height;
}
//Функция передвижения объекта
public void MoveTransport(Direction direction)
{
if (!_pictureWidth.HasValue || !_pictureHeight.HasValue) return;
@ -57,6 +60,7 @@ namespace WarmlyShip
}
}
//Отрисовка транспорта
public virtual void DrawTransport(Graphics g)
{
if (_startPosX < 0 || _startPosY < 0 || !_pictureHeight.HasValue || !_pictureWidth.HasValue)
@ -89,6 +93,7 @@ namespace WarmlyShip
g.DrawEllipse(new(Color.Blue, 2), _startPosX + _warmlyShipWidth * 2 / 5 + 2.5f, _startPosY + 25, 20, 20);
}
//Изменение границ отрисовки
public void ChangeBorders(int width, int height)
{
_pictureWidth = width;

View File

@ -12,6 +12,7 @@ namespace WarmlyShip
public bool BodyKit { get; private set; }
public bool Wing { get; private set; }
public bool SportLine { get; private set; }
public EntityMotorShip(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool sportLine) : base(speed, weight, bodyColor)
{
DopColor = dopColor;