поменял инициализаторы на конструкторы

This commit is contained in:
MaxKarme 2022-09-20 22:04:02 +03:00
parent 372af42b19
commit 496f946e45
3 changed files with 4 additions and 7 deletions

View File

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

View File

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

View File

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