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}";