Kasatkin S.P LabWork2 #2

Merged
eegov merged 4 commits from LabWork2 into LabWork1 2022-09-30 11:49:20 +04:00
3 changed files with 4 additions and 6 deletions
Showing only changes of commit 5669b4e535 - Show all commits

View File

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

View File

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

View File

@ -28,8 +28,7 @@ namespace ProjectLocomotive
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
_elloc = new DrawningLocomotive();
_elloc.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_elloc = new DrawningLocomotive(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_elloc.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxLocomotive.Width, pictureBoxLocomotive.Height);
toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü: {_elloc.Locomotivå.Speed}";
toolStripStatusLabelWeight.Text = $"Âåñ: {_elloc.Locomotivå.Weight}";