Lisov N.A. Lab_work2 #2

Merged
eegov merged 11 commits from LabWork02 into LabWork01 2022-09-30 09:43:17 +04:00
3 changed files with 4 additions and 6 deletions
Showing only changes of commit ee5a000d55 - Show all commits

View File

@ -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}";

View File

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

View File

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