Compare commits
2 Commits
02c4fa2ec2
...
da474218e8
Author | SHA1 | Date | |
---|---|---|---|
|
da474218e8 | ||
|
a7f1fc2910 |
@ -57,14 +57,17 @@ namespace Tank
|
||||
public bool Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool bodyKit, bool trunk, bool sportLine, int width, int height)
|
||||
{
|
||||
// TODO: Продумать проверки
|
||||
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityTank = new EntityTank();
|
||||
EntityTank.Init(speed, weight, bodyColor, additionalColor,
|
||||
bodyKit, trunk, sportLine);
|
||||
return true;
|
||||
// проверки
|
||||
if (width > _tankWidth && height > _tankHeight && speed > 0 && weight > 0)
|
||||
{
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
EntityTank = new EntityTank();
|
||||
EntityTank.Init(speed, weight, bodyColor, additionalColor,
|
||||
bodyKit, trunk, sportLine);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка позиции
|
||||
@ -73,8 +76,13 @@ namespace Tank
|
||||
/// <param name="y">Координата Y</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
// проверки
|
||||
if (x >= 0 && x + _tankWidth <= _pictureWidth &&
|
||||
y >= 0 && y + _tankHeight <= _pictureHeight)
|
||||
{
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
|
@ -37,9 +37,9 @@ namespace Tank
|
||||
/// </summary>
|
||||
public bool SportLine { get; private set; }
|
||||
/// <summary>
|
||||
/// Шаг перемещения автомобиля
|
||||
/// Шаг перемещения танка
|
||||
/// </summary>
|
||||
public double Step => (double)Speed * 100 / Weight;
|
||||
public double Step => (double)Speed * 200 / Weight;
|
||||
/// <summary>
|
||||
/// Инициализация полей объекта-класса спортивного автомобиля
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user