diff --git a/AirFighter/AirFighter/DrawningAirFighter.cs b/AirFighter/AirFighter/DrawningAirFighter.cs index 839168c..edba9d3 100644 --- a/AirFighter/AirFighter/DrawningAirFighter.cs +++ b/AirFighter/AirFighter/DrawningAirFighter.cs @@ -45,10 +45,9 @@ namespace AirFighter /// Скорость /// Вес самолета /// Цвет кузова - public void Init(int speed, float weight, Color bodyColor) + public DrawningAirFighter(int speed, float weight, Color bodyColor) { - AirFighter = new EntityAirFighter(); - AirFighter.Init(speed, weight, bodyColor); + AirFighter = new EntityAirFighter(speed, weight, bodyColor); } /// /// Установка позиции самолета diff --git a/AirFighter/AirFighter/EntityAirFighter.cs b/AirFighter/AirFighter/EntityAirFighter.cs index 9a2262c..0aa3e36 100644 --- a/AirFighter/AirFighter/EntityAirFighter.cs +++ b/AirFighter/AirFighter/EntityAirFighter.cs @@ -34,7 +34,7 @@ namespace AirFighter /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityAirFighter(int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/AirFighter/AirFighter/FormAirFighter.cs b/AirFighter/AirFighter/FormAirFighter.cs index 111abdd..f5dc5f1 100644 --- a/AirFighter/AirFighter/FormAirFighter.cs +++ b/AirFighter/AirFighter/FormAirFighter.cs @@ -24,9 +24,8 @@ namespace AirFighter /// private void ButtonCreate_Click(object sender, EventArgs e) { - _airFighter = new DrawningAirFighter(); Random rnd = new Random(); - _airFighter.Init(rnd.Next(200, 500), rnd.Next(2000, 5000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _airFighter = new DrawningAirFighter(rnd.Next(200, 500), rnd.Next(2000, 5000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _airFighter.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height); toolStripStatusLabelSpeed.Text = $": {_airFighter.AirFighter?.Speed}"; toolStripStatusLabelWeight.Text = $": {_airFighter.AirFighter?.Weight}";