Sorokin P.V. Lab work 2 #2

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

View File

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

View File

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

View File

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