diff --git a/Liner/Liner/DrawingShip.cs b/Liner/Liner/DrawingShip.cs index 36c8ff3..2ce7dc1 100644 --- a/Liner/Liner/DrawingShip.cs +++ b/Liner/Liner/DrawingShip.cs @@ -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) diff --git a/Liner/Liner/EntityShip.cs b/Liner/Liner/EntityShip.cs index 46613d6..7946fa5 100644 --- a/Liner/Liner/EntityShip.cs +++ b/Liner/Liner/EntityShip.cs @@ -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; diff --git a/Liner/Liner/FormShip.cs b/Liner/Liner/FormShip.cs index 4eb0604..68223cf 100644 --- a/Liner/Liner/FormShip.cs +++ b/Liner/Liner/FormShip.cs @@ -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}";