Sorokin P.V. Lab work 2 #2
@ -15,10 +15,9 @@ namespace Liner
|
||||
private int? _pictureHeight = null;
|
||||
protected readonly int _ShipWidth = 120;
|
||||
protected readonly int _ShipHeight = 40;
|
||||
public void Init(int speed, float weight, Color bodycolor)
|
||||
public DrawingShip(int speed, float weight, Color bodycolor)
|
||||
{
|
||||
Ship = new EntityShip();
|
||||
Ship.Init(speed, weight, bodycolor);
|
||||
Ship = new EntityShip(speed, weight, bodycolor);
|
||||
}
|
||||
|
||||
public void SetPosition(int x, int y, int width, int height)
|
||||
|
@ -16,7 +16,7 @@ namespace Liner
|
||||
|
||||
public float Step => Speed * 100 / Weight;
|
||||
|
||||
public void Init(int speed, float weight, Color bodycolor)
|
||||
public EntityShip(int speed, float weight, Color bodycolor)
|
||||
{
|
||||
Speed = speed;
|
||||
Weight = weight;
|
||||
|
@ -23,8 +23,7 @@ namespace Liner
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
_ship = new DrawingShip();
|
||||
_ship.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
_ship = new DrawingShip(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
_ship.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxShip.Width, pictureBoxShip.Height);
|
||||
toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü: {_ship.Ship?.Speed}";
|
||||
toolStripStatusLabelWeight.Text = $"Âåñ: {_ship.Ship?.Weight}";
|
||||
|
Loading…
Reference in New Issue
Block a user