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