From f282067ee40f8eaa89670f004b631580c64ba96c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D0=BA=D1=81=20=D0=91=D0=BE=D0=BD=D0=B4=D0=B0?= =?UTF-8?q?=D1=80=D0=B5=D0=BD=D0=BA=D0=BE?= Date: Fri, 30 Sep 2022 18:58:18 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D1=81=D0=BB=D0=B5=D0=B4=D0=BD?= =?UTF-8?q?=D0=B8=D0=B9=20=D0=BA=D0=BE=D0=BC=D0=BC=D0=B8=D1=82.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs | 5 +++++ WarmlyShip/WarmlyShip/EntityWarmlyShip.cs | 1 + 2 files changed, 6 insertions(+) diff --git a/WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs b/WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs index b131644..36a30b4 100644 --- a/WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/DrawingWarmlyShip.cs @@ -16,12 +16,14 @@ namespace WarmlyShip private readonly int _warmlyShipWidth = 125; //Ширина отрисовки корабля private readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля + //Инициализация public void Init(int speed, float weight, Color bodyColor) { warmlyShip = new EntityWarmlyShip(); warmlyShip.Init(speed, weight, bodyColor); } + //Начальные коордитанты public void SetPosition(int x, int y, int width, int height) { if (width < _warmlyShipWidth || height < _warmlyShipHeight) return; @@ -32,6 +34,7 @@ namespace WarmlyShip _pictureHeight = height; } + //Движение транспорта по координатам public void MoveTransport(Direction direction) { if (!_pictureWidth.HasValue || !_pictureHeight.HasValue) return; @@ -52,6 +55,7 @@ namespace WarmlyShip } } + //Отрисовка транспорта public void DrawTransport(Graphics g) { 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); } + //Изменение границ отрисовки public void ChangeBorders(int width, int height) { _pictureWidth = width; diff --git a/WarmlyShip/WarmlyShip/EntityWarmlyShip.cs b/WarmlyShip/WarmlyShip/EntityWarmlyShip.cs index 29576fb..4fb169a 100644 --- a/WarmlyShip/WarmlyShip/EntityWarmlyShip.cs +++ b/WarmlyShip/WarmlyShip/EntityWarmlyShip.cs @@ -13,6 +13,7 @@ namespace WarmlyShip public Color BodyColor { get; private set; } //Цвет public float Step => Speed * 100 / Weight; //Шаг при перемещении + //Инициализация public void Init(int speed, float weight, Color bodyColor) { Random random = new Random();