From 496f946e45f0302cd3c0938770f68cbfe7f7b99d Mon Sep 17 00:00:00 2001 From: MaxKarme <91691525+MaxKarme@users.noreply.github.com> Date: Tue, 20 Sep 2022 22:04:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BF=D0=BE=D0=BC=D0=B5=D0=BD=D1=8F=D0=BB=20?= =?UTF-8?q?=D0=B8=D0=BD=D0=B8=D1=86=D0=B8=D0=B0=D0=BB=D0=B8=D0=B7=D0=B0?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D1=8B=20=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=81=D1=82=D1=80=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 --- AirFighter/AirFighter/DrawingAirFighter.cs | 5 ++--- AirFighter/AirFighter/EntityAirFighter.cs | 2 +- AirFighter/AirFighter/FormAirFighter.cs | 4 +--- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/AirFighter/AirFighter/DrawingAirFighter.cs b/AirFighter/AirFighter/DrawingAirFighter.cs index 94d1b4f..5d85573 100644 --- a/AirFighter/AirFighter/DrawingAirFighter.cs +++ b/AirFighter/AirFighter/DrawingAirFighter.cs @@ -19,10 +19,9 @@ namespace AirFighter private readonly int _airFighterWidth = 195; private readonly int _airFighterHeight = 166; - public void Init(int speed, float weight, Color bodyColor) + public DrawingAirFighter(int speed, float weight, Color bodyColor) { - AirFighter = new EntityAirFighter(); - AirFighter.Init(speed, weight, bodyColor); + AirFighter = new EntityAirFighter(speed, weight, bodyColor); } public void SetPosition(int x, int y, int width, int height) diff --git a/AirFighter/AirFighter/EntityAirFighter.cs b/AirFighter/AirFighter/EntityAirFighter.cs index f1d1eaa..6a2e3e9 100644 --- a/AirFighter/AirFighter/EntityAirFighter.cs +++ b/AirFighter/AirFighter/EntityAirFighter.cs @@ -14,7 +14,7 @@ namespace AirFighter public float Step => Speed * 100 / Weight; - public void Init(int speed, float weight, Color bodyColor) + public EntityAirFighter(int speed, float weight, Color bodyColor) { Random rnd = new(); diff --git a/AirFighter/AirFighter/FormAirFighter.cs b/AirFighter/AirFighter/FormAirFighter.cs index b33c0a6..4c3639b 100644 --- a/AirFighter/AirFighter/FormAirFighter.cs +++ b/AirFighter/AirFighter/FormAirFighter.cs @@ -13,9 +13,7 @@ namespace AirFighter { Random rnd = new(); - _airFighter = new DrawingAirFighter(); - - _airFighter.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), + _airFighter = new DrawingAirFighter(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _airFighter.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBox.Width, pictureBox.Height);