From b8af73b6a60b75fba897349e8a4b2239b18448b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=93=D0=B0=D0=BB=D0=B8=D0=BD=D0=B0=20=D0=A4=D0=B5=D0=B4?= =?UTF-8?q?=D0=BE=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Wed, 27 Sep 2023 08:56:01 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=B1=D0=BE=D0=BB=D1=8C=D1=88?= =?UTF-8?q?=D0=B8=D0=B5=20=D0=BF=D1=80=D0=B0=D0=B2=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Hydroplane/DrawingHydroplane.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) 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); } ///