Lisov N.A. Lab_work2 #2
@ -22,8 +22,7 @@ namespace AirFighter
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new Random();
|
||||
_aircraft = new DrawingAircraft();
|
||||
_aircraft.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
_aircraft = new DrawingAircraft(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
_aircraft.SetPosition(rnd.Next(10,100),rnd.Next(10,100),pictureBoxAirFighter.Width,pictureBoxAirFighter.Height);
|
||||
toolStripStatusSpeed.Text = $"Speed: {_aircraft.Plane.Speed}";
|
||||
toolStripStatusWeight.Text = $"Weight: {_aircraft.Plane.Weight}";
|
||||
|
@ -23,10 +23,9 @@ namespace AirFighter
|
||||
protected readonly int _aircraftWidth = 100;
|
||||
protected readonly int _aircraftHeight = 100;
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public DrawingAircraft(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Plane = new EntityAircraft();
|
||||
Plane.Init(speed, weight, bodyColor);
|
||||
Plane = new EntityAircraft(speed, weight, bodyColor);
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y, int width, int height)
|
||||
|
@ -30,7 +30,7 @@ namespace AirFighter
|
||||
public float Step => Speed * 100 / Weight;
|
||||
|
||||
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public EntityAircraft(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
|
Loading…
Reference in New Issue
Block a user