diff --git a/Tank/Tank/DrawingTank.cs b/Tank/Tank/DrawingTank.cs index 3de0709..a92ada5 100644 --- a/Tank/Tank/DrawingTank.cs +++ b/Tank/Tank/DrawingTank.cs @@ -58,13 +58,16 @@ namespace Tank 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; } /// /// Установка позиции @@ -73,8 +76,13 @@ namespace Tank /// Координата Y 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; + } } /// /// Изменение направления перемещения diff --git a/Tank/Tank/EntityTank.cs b/Tank/Tank/EntityTank.cs index 5f56106..35be974 100644 --- a/Tank/Tank/EntityTank.cs +++ b/Tank/Tank/EntityTank.cs @@ -37,9 +37,9 @@ namespace Tank /// public bool SportLine { get; private set; } /// - /// Шаг перемещения автомобиля + /// Шаг перемещения танка /// - public double Step => (double)Speed * 100 / Weight; + public double Step => (double)Speed * 200 / Weight; /// /// Инициализация полей объекта-класса спортивного автомобиля ///