From 001cdd770b796189428b88a809ea1b8aaf93b93a Mon Sep 17 00:00:00 2001 From: "ityurner02@mail.ru" Date: Sat, 17 Sep 2022 17:17:24 +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 --- AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs | 5 ++--- AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs | 2 +- AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs index e213dc6..274c5f4 100644 --- a/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs +++ b/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs @@ -45,10 +45,9 @@ namespace AntiAircraftGun /// Скорость /// Вес зенитного орудия /// Цвет корпуса - public void Init(int speed, float weight, Color bodyColor) + public DrawingAntiAircraftGun(int speed, float weight, Color bodyColor) { - AntiAircraftGun = new EntityAntiAircraftGun(); - AntiAircraftGun.Init(speed, weight, bodyColor); + AntiAircraftGun = new EntityAntiAircraftGun(speed, weight, bodyColor); } /// /// Установка позиции зенитного орудия diff --git a/AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs index f81d3d8..a9705c9 100644 --- a/AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs +++ b/AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs @@ -31,7 +31,7 @@ namespace AntiAircraftGun /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityAntiAircraftGun(int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs index a3430d4..f4902d0 100644 --- a/AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs +++ b/AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs @@ -32,8 +32,7 @@ namespace AntiAircraftGun private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _antiAircrafGun = new DrawingAntiAircraftGun(); - _antiAircrafGun.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), + _antiAircrafGun = new DrawingAntiAircraftGun(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _antiAircrafGun.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);