Komlev_S.I. Lab2 #4
@ -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>
|
||||
/// Установка позиции танкера
|
||||
|
@ -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;
|
||||
|
@ -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}";
|
||||
|
Loading…
Reference in New Issue
Block a user