diff --git a/Hydroplane/DrawingHydroplane.cs b/Hydroplane/DrawingHydroplane.cs index d38bb5b..19abd4c 100644 --- a/Hydroplane/DrawingHydroplane.cs +++ b/Hydroplane/DrawingHydroplane.cs @@ -35,7 +35,7 @@ namespace Hydroplane /// /// Высота прорисовки гидроплана /// - private readonly int _planeHeight = 100; + private readonly int _planeHeight = 80; /// /// Инициализация свойств /// @@ -51,9 +51,12 @@ namespace Hydroplane public bool Init(int speed, double weight, Color bodyColor, Color additionalColor, bool boat, bool bobber, int width, int height) { - // TODO: Продумать проверки _pictureWidth = width; _pictureHeight = height; + if (_pictureWidth < _planeWidth || _pictureHeight < _planeHeight) + { + return false; + } EntityHydroplane = new EntityHydroplane(); EntityHydroplane.Init(speed, weight, bodyColor, additionalColor, boat, bobber); @@ -67,9 +70,8 @@ namespace Hydroplane /// Координата Y public void SetPosition(int x, int y) { - // TODO: Изменение x, y - _startPosX = x; - _startPosY = y; + _startPosX = Math.Min(x, _pictureWidth - _planeWidth); + _startPosY = Math.Min(y, _pictureHeight - _planeHeight); } ///