diff --git a/AirBomber/AirBomber/DrawingAirBomber.cs b/AirBomber/AirBomber/DrawingAirBomber.cs index 3f32384..74e8b6f 100644 --- a/AirBomber/AirBomber/DrawingAirBomber.cs +++ b/AirBomber/AirBomber/DrawingAirBomber.cs @@ -42,10 +42,9 @@ namespace AirBomber /// Скорость /// Вес бомбардировщика /// Цвет корпуса - public void Init(int speed, float weight, Color bodyColor) + public DrawingAirBomber(int speed, float weight, Color bodyColor) { - AirBomber = new EntityAirBomber(); - AirBomber.Init(speed, weight, bodyColor); + AirBomber = new EntityAirBomber(speed, weight, bodyColor); } /// diff --git a/AirBomber/AirBomber/EntityAirBomber.cs b/AirBomber/AirBomber/EntityAirBomber.cs index dfdae8a..3662c4b 100644 --- a/AirBomber/AirBomber/EntityAirBomber.cs +++ b/AirBomber/AirBomber/EntityAirBomber.cs @@ -34,7 +34,7 @@ namespace AirBomber /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityAirBomber (int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/AirBomber/AirBomber/FormAirBomber.cs b/AirBomber/AirBomber/FormAirBomber.cs index a854805..3f41ac3 100644 --- a/AirBomber/AirBomber/FormAirBomber.cs +++ b/AirBomber/AirBomber/FormAirBomber.cs @@ -24,8 +24,7 @@ namespace AirBomber private void buttonCreateAirBomber_Click(object sender, EventArgs e) { Random rnd = new(); - _airBomber = new DrawingAirBomber(); - _airBomber.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _airBomber = new DrawingAirBomber(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _airBomber.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirBomber.Width, pictureBoxAirBomber.Height); toolStripStatusLabelSpeed.Text = $": {_airBomber.AirBomber.Speed}"; toolStripStatusLabelWeight.Text = $": {_airBomber.AirBomber.Weight}";