Fadeeva A.A. LabWork02 #3

Closed
Nastya wants to merge 4 commits from LabWork02 into LabWork01
3 changed files with 4 additions and 6 deletions
Showing only changes of commit fc67dec55e - Show all commits

View File

@ -45,10 +45,9 @@ namespace WarmlyShip
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес корабля</param>
/// <param name="bodyColor">Цвет палубы</param>
public void Init(int speed, float weight, Color bodyColor)
public DrawningShip(int speed, float weight, Color bodyColor)
{
Ship = new EntityShip();
Ship.Init(speed, weight, bodyColor);
Ship = new EntityShip(speed, weight, bodyColor);
}
/// <summary>

View File

@ -35,7 +35,7 @@ namespace WarmlyShip
/// <param name="weight"></param>
/// <param name="bodyColor"></param>
/// <returns></returns>
public void Init(int speed, float weight, Color bodyColor)
public EntityShip(int speed, float weight, Color bodyColor)
{
Random rnd = new();
Speed = speed <= 0 ? rnd.Next(50, 150) : speed;

View File

@ -28,8 +28,7 @@ namespace WarmlyShip
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
_ship = new DrawningShip();
_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 DrawningShip(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}";