From 73b439929b08e7d7093e0f847cb78f87adae601e Mon Sep 17 00:00:00 2001 From: "Nikolaeva_Y.A" Date: Mon, 24 Oct 2022 22:57:03 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA?= =?UTF-8?q?=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/DrawingAirbus.cs | 5 ++--- Airbus/Airbus/EntityAirbus.cs | 2 +- Airbus/Airbus/FormAirbus.cs | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Airbus/Airbus/DrawingAirbus.cs b/Airbus/Airbus/DrawingAirbus.cs index c6922d3..ced977d 100644 --- a/Airbus/Airbus/DrawingAirbus.cs +++ b/Airbus/Airbus/DrawingAirbus.cs @@ -24,10 +24,9 @@ namespace Airbus protected readonly int _airbusHeight = 62; //высота отрисовки самолёта //инициализаци свойств - public void Initial(int speed, float weight, Color corpusColor) + public DrawingAirbus(int speed, float weight, Color corpusColor) { - Airbus = new EntityAirbus(); - Airbus.Initial(speed, weight, corpusColor); + Airbus = new EntityAirbus(speed, weight, corpusColor); } //установка координат позиции самолёта diff --git a/Airbus/Airbus/EntityAirbus.cs b/Airbus/Airbus/EntityAirbus.cs index 1aeb7f0..303458d 100644 --- a/Airbus/Airbus/EntityAirbus.cs +++ b/Airbus/Airbus/EntityAirbus.cs @@ -12,7 +12,7 @@ namespace Airbus public float Weight { get; private set; } //вес public Color CorpusColor { get; private set; } //цвет корпуса public float Step => Speed * 100 / Weight; //шаг перемещения самолёта - public void Initial(int speed, float weight, Color corpusColor) + public EntityAirbus(int speed, float weight, Color corpusColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/Airbus/Airbus/FormAirbus.cs b/Airbus/Airbus/FormAirbus.cs index 7ae76e3..06362ca 100644 --- a/Airbus/Airbus/FormAirbus.cs +++ b/Airbus/Airbus/FormAirbus.cs @@ -30,8 +30,7 @@ namespace Airbus private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _airbus = new DrawingAirbus(); - _airbus.Initial(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _airbus = new DrawingAirbus(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _airbus.SetPosition(rnd.Next(10, 110), rnd.Next(10, 110), pictureBoxAirbus.Width, pictureBoxAirbus.Height); toolStripStatusLabelSpeed.Text = $": {_airbus.Airbus?.Speed}"; toolStripStatusLabelWeight.Text = $": {_airbus.Airbus?.Weight}";