From fc67dec55e10cf4663c8bf81939b09db17bd677a Mon Sep 17 00:00:00 2001 From: crum61kg Date: Sun, 2 Oct 2022 21:36:21 +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 --- WarmlyShip/WarmlyShip/DrawningShip.cs | 5 ++--- WarmlyShip/WarmlyShip/EntityShip.cs | 2 +- WarmlyShip/WarmlyShip/FormShip.cs | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/WarmlyShip/WarmlyShip/DrawningShip.cs b/WarmlyShip/WarmlyShip/DrawningShip.cs index 17629e9..910fb29 100644 --- a/WarmlyShip/WarmlyShip/DrawningShip.cs +++ b/WarmlyShip/WarmlyShip/DrawningShip.cs @@ -45,10 +45,9 @@ namespace WarmlyShip /// Скорость /// Вес корабля /// Цвет палубы - public void Init(int speed, float weight, Color bodyColor) + public DrawningShip(int speed, float weight, Color bodyColor) { - Ship = new EntityShip(); - Ship.Init(speed, weight, bodyColor); + Ship = new EntityShip(speed, weight, bodyColor); } /// diff --git a/WarmlyShip/WarmlyShip/EntityShip.cs b/WarmlyShip/WarmlyShip/EntityShip.cs index 0907d72..43b9e48 100644 --- a/WarmlyShip/WarmlyShip/EntityShip.cs +++ b/WarmlyShip/WarmlyShip/EntityShip.cs @@ -35,7 +35,7 @@ namespace WarmlyShip /// /// /// - 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/WarmlyShip/WarmlyShip/FormShip.cs b/WarmlyShip/WarmlyShip/FormShip.cs index d52fa61..1ee0920 100644 --- a/WarmlyShip/WarmlyShip/FormShip.cs +++ b/WarmlyShip/WarmlyShip/FormShip.cs @@ -28,8 +28,7 @@ namespace WarmlyShip private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _ship = new DrawningShip(); - _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 DrawningShip(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), rnd.Next(10, 100), pictureBoxShip.Width, pictureBoxShip.Height); toolStripStatusLabelSpeed.Text = $": {_ship.Ship.Speed}"; toolStripStatusLabelWeight.Text = $": {_ship.Ship.Weight}";