diff --git a/AirFighter/AirFighter/DrawningAirFighter.cs b/AirFighter/AirFighter/DrawningAirFighter.cs index de9b72e..839168c 100644 --- a/AirFighter/AirFighter/DrawningAirFighter.cs +++ b/AirFighter/AirFighter/DrawningAirFighter.cs @@ -45,9 +45,10 @@ namespace AirFighter /// Скорость /// Вес самолета /// Цвет кузова - public void Init(EntityAirFighter _entityAirFighter) + public void Init(int speed, float weight, Color bodyColor) { - AirFighter = _entityAirFighter; + AirFighter = new EntityAirFighter(); + AirFighter.Init(speed, weight, bodyColor); } /// /// Установка позиции самолета diff --git a/AirFighter/AirFighter/FormAirFighter.cs b/AirFighter/AirFighter/FormAirFighter.cs index cc76b1a..111abdd 100644 --- a/AirFighter/AirFighter/FormAirFighter.cs +++ b/AirFighter/AirFighter/FormAirFighter.cs @@ -26,9 +26,7 @@ namespace AirFighter { _airFighter = new DrawningAirFighter(); Random rnd = new Random(); - EntityAirFighter entityAirFighter = new EntityAirFighter(); - entityAirFighter?.Init(rnd.Next(200, 500), rnd.Next(2000, 5000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); - _airFighter.Init(entityAirFighter); + _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.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height); toolStripStatusLabelSpeed.Text = $": {_airFighter.AirFighter?.Speed}"; toolStripStatusLabelWeight.Text = $": {_airFighter.AirFighter?.Weight}";