Lab2 #2

Closed
just_valery__ wants to merge 7 commits from Lab2 into Lab1
3 changed files with 4 additions and 6 deletions
Showing only changes of commit b699fe0553 - Show all commits

View File

@ -36,10 +36,9 @@
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес коробля</param>
/// <param name="bodyColor">Цвет основной части</param>
public void Init(int speed, float weight, Color bodyColor)
public DrawningWarmlyShip(int speed, float weight, Color bodyColor)
{
Ship = new EntityWarmlyShip();
Ship.Init(speed, weight, bodyColor);
Ship = new EntityWarmlyShip(speed, weight, bodyColor);
}
/// <summary>
/// Установка позиции коробля

View File

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

View File

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