Bondarenko M.S. Lab Work 1 #1
@ -16,12 +16,14 @@ namespace WarmlyShip
|
||||
private readonly int _warmlyShipWidth = 125; //Ширина отрисовки корабля
|
||||
private readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля
|
||||
|
||||
//Инициализация
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
warmlyShip = new EntityWarmlyShip();
|
||||
warmlyShip.Init(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
//Начальные коордитанты
|
||||
public void SetPosition(int x, int y, int width, int height)
|
||||
{
|
||||
if (width < _warmlyShipWidth || height < _warmlyShipHeight) return;
|
||||
@ -32,6 +34,7 @@ namespace WarmlyShip
|
||||
_pictureHeight = height;
|
||||
}
|
||||
|
||||
//Движение транспорта по координатам
|
||||
public void MoveTransport(Direction direction)
|
||||
{
|
||||
if (!_pictureWidth.HasValue || !_pictureHeight.HasValue) return;
|
||||
@ -52,6 +55,7 @@ namespace WarmlyShip
|
||||
}
|
||||
}
|
||||
|
||||
//Отрисовка транспорта
|
||||
public void DrawTransport(Graphics g)
|
||||
{
|
||||
if (_startPosX < 0 || _startPosY < 0 || !_pictureHeight.HasValue || !_pictureWidth.HasValue)
|
||||
@ -84,6 +88,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;
|
||||
|
@ -13,6 +13,7 @@ namespace WarmlyShip
|
||||
public Color BodyColor { get; private set; } //Цвет
|
||||
public float Step => Speed * 100 / Weight; //Шаг при перемещении
|
||||
|
||||
//Инициализация
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Random random = new Random();
|
||||
|
Loading…
Reference in New Issue
Block a user