From 91d21e30812de0a8d30c191278e9449583e1d3bf Mon Sep 17 00:00:00 2001 From: Danil Kargin Date: Wed, 5 Oct 2022 22:53:56 +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 --- AirFighter/AirFighter/DrawningAirFighter.cs | 5 ++--- AirFighter/AirFighter/EntityAirFighter.cs | 2 +- AirFighter/AirFighter/FormAirFighter.cs | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) 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}";