diff --git a/Airbus/Airbus/DrawningPlane.cs b/Airbus/Airbus/DrawningPlane.cs index 88d7b81..4736f21 100644 --- a/Airbus/Airbus/DrawningPlane.cs +++ b/Airbus/Airbus/DrawningPlane.cs @@ -45,10 +45,10 @@ namespace Airbus /// Скорость /// Вес самолета /// Цвет кузова - public void Init(int speed, float weight, Color bodyColor) + public DrawningPlane(int speed, float weight, Color bodyColor) { - Plane = new EntityPlane(); - Plane.Init(speed, weight, bodyColor); + Plane = new EntityPlane(speed, weight, bodyColor); + } /// /// Установка позиции самолета diff --git a/Airbus/Airbus/EntityPlane.cs b/Airbus/Airbus/EntityPlane.cs index 1e10442..ebe0d63 100644 --- a/Airbus/Airbus/EntityPlane.cs +++ b/Airbus/Airbus/EntityPlane.cs @@ -31,7 +31,7 @@ namespace Airbus /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityPlane(int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/Airbus/Airbus/FormPlane.cs b/Airbus/Airbus/FormPlane.cs index c0fee1f..5a38b1c 100644 --- a/Airbus/Airbus/FormPlane.cs +++ b/Airbus/Airbus/FormPlane.cs @@ -37,8 +37,7 @@ namespace Airbus { Random rnd = new(); - _plane = new DrawningPlane(); - _plane.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _plane = new DrawningPlane(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _plane.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirbus.Width, pictureBoxAirbus.Height); toolStripStatusLabelSpeed.Text = $"Скорость: {_plane.Plane.Speed}"; toolStripStatusLabelWeight.Text = $"Вес: {_plane.Plane.Weight}";