From b9ad742c3fa5e2f38d681a0b13decf66e41b6144 Mon Sep 17 00:00:00 2001 From: the Date: Tue, 27 Sep 2022 09:34:26 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Ship/Ship/DrawingShip.cs | 5 ++--- Ship/Ship/EntityShip.cs | 2 +- Ship/Ship/FormShip.cs | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/Ship/Ship/DrawingShip.cs b/Ship/Ship/DrawingShip.cs index 1f2755d..e2b98e5 100644 --- a/Ship/Ship/DrawingShip.cs +++ b/Ship/Ship/DrawingShip.cs @@ -42,10 +42,9 @@ namespace Ship /// Скорость /// Вес корабля /// Цвет корпуса - public void Init(int speed, float weight, Color bodyColor) + public DrawingShip(int speed, float weight, Color bodyColor) { - Ship = new EntityShip(); - Ship.Init(speed, weight, bodyColor); + Ship = new EntityShip(speed, weight, bodyColor); } /// /// Установка позиции корабля diff --git a/Ship/Ship/EntityShip.cs b/Ship/Ship/EntityShip.cs index c714ffb..b556451 100644 --- a/Ship/Ship/EntityShip.cs +++ b/Ship/Ship/EntityShip.cs @@ -31,7 +31,7 @@ namespace Ship /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityShip(int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/Ship/Ship/FormShip.cs b/Ship/Ship/FormShip.cs index 8b0e33a..461105a 100644 --- a/Ship/Ship/FormShip.cs +++ b/Ship/Ship/FormShip.cs @@ -26,9 +26,7 @@ namespace Ship private void buttonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _ship = new DrawingShip(); - _ship.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), - Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _ship = new DrawingShip(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _ship.SetPosition(rnd.Next(10, 100), pictureBoxShip.Height - rnd.Next(20, 100), pictureBoxShip.Width, pictureBoxShip.Height); toolStripStatusLabelSpeed.Text = $": {_ship.Ship.Speed}";