From 928fa3a1df577db3d33ae7797c4b2b54aeb5307a Mon Sep 17 00:00:00 2001 From: ArtemEmelyanov Date: Sat, 15 Oct 2022 22:17:30 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4?= =?UTF-8?q?=D1=8B=20=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80?= =?UTF-8?q?=D1=83=D0=BA=D1=82=D0=BE=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Airbus/Airbus/DrawningPlane.cs | 6 +++--- Airbus/Airbus/EntityPlane.cs | 2 +- Airbus/Airbus/FormPlane.cs | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) 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}";