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