Komlev_S.I. Lab2 #4

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

View File

@ -45,10 +45,9 @@ namespace GasolineTanker
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес танкера</param>
/// <param name="bodyColor">Цвет кузова</param>
public void Init(int speed, float weight, Color bodyColor)
public DrawningTanker(int speed, float weight, Color bodyColor)
{
Tanker = new EntityTanker();
Tanker.Init(speed, weight, bodyColor);
Tanker = new EntityTanker(speed, weight, bodyColor);
}
/// <summary>
/// Установка позиции танкера

View File

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

View File

@ -26,8 +26,7 @@ namespace GasolineTanker
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
_Tanker = new DrawningTanker();
_Tanker.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_Tanker = new DrawningTanker(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_Tanker.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxTanker.Width, pictureBoxTanker.Height);
toolStripStatusSpeed.Text = $"Ñêîðîñòü: {_Tanker.Tanker.Speed}";
toolStripStatusWeight.Text = $"Âåñ: {_Tanker.Tanker.Weight}";