From ae14815155425af5a5c692d1d9ac49dd18e5e9ab Mon Sep 17 00:00:00 2001 From: Anastasia Date: Mon, 3 Oct 2022 20:14:22 +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 --- AirplaneWithRadar/AirplaneWithRadar/DrawingAirplane.cs | 5 ++--- AirplaneWithRadar/AirplaneWithRadar/EntityAirplane.cs | 2 +- AirplaneWithRadar/AirplaneWithRadar/FormAirplaneWithRadar.cs | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/AirplaneWithRadar/AirplaneWithRadar/DrawingAirplane.cs b/AirplaneWithRadar/AirplaneWithRadar/DrawingAirplane.cs index 8998dae..040c5d1 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/DrawingAirplane.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/DrawingAirplane.cs @@ -45,10 +45,9 @@ namespace AirplaneWithRadar /// Скорость /// Вес самолета /// Цвет кузова - public void Init(int speed, float weight, Color bodyColor) + public DrawingAirplane(int speed, float weight, Color bodyColor) { - Airplane = new EntityAirplane(); - Airplane.Init(speed, weight, bodyColor); + Airplane = new EntityAirplane(speed, weight, bodyColor); } /// /// Установка позиции самолета diff --git a/AirplaneWithRadar/AirplaneWithRadar/EntityAirplane.cs b/AirplaneWithRadar/AirplaneWithRadar/EntityAirplane.cs index 6a6ab6a..167e6dc 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/EntityAirplane.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/EntityAirplane.cs @@ -35,7 +35,7 @@ namespace AirplaneWithRadar /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityAirplane(int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneWithRadar.cs b/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneWithRadar.cs index bc58cf5..33e772e 100644 --- a/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneWithRadar.cs +++ b/AirplaneWithRadar/AirplaneWithRadar/FormAirplaneWithRadar.cs @@ -27,8 +27,7 @@ namespace AirplaneWithRadar private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _airplane = new DrawingAirplane(); - _airplane.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), + _airplane = new DrawingAirplane(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _airplane.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirplane.Width, pictureBoxAirplane.Height);