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);