поменял инициализаторы на конструкторы
This commit is contained in:
parent
372af42b19
commit
496f946e45
@ -19,10 +19,9 @@ namespace AirFighter
|
|||||||
private readonly int _airFighterWidth = 195;
|
private readonly int _airFighterWidth = 195;
|
||||||
private readonly int _airFighterHeight = 166;
|
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 = new EntityAirFighter(speed, weight, bodyColor);
|
||||||
AirFighter.Init(speed, weight, bodyColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPosition(int x, int y, int width, int height)
|
public void SetPosition(int x, int y, int width, int height)
|
||||||
|
@ -14,7 +14,7 @@ namespace AirFighter
|
|||||||
|
|
||||||
public float Step => Speed * 100 / Weight;
|
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();
|
Random rnd = new();
|
||||||
|
|
||||||
|
@ -13,9 +13,7 @@ namespace AirFighter
|
|||||||
{
|
{
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
|
|
||||||
_airFighter = new DrawingAirFighter();
|
_airFighter = new DrawingAirFighter(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
||||||
|
|
||||||
_airFighter.Init(rnd.Next(100, 300), rnd.Next(1000, 2000),
|
|
||||||
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
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);
|
_airFighter.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBox.Width, pictureBox.Height);
|
||||||
|
Loading…
Reference in New Issue
Block a user