ISEbd-21 Vasina E.S. Lab02 #2

Merged
eegov merged 5 commits from LabWork02 into LabWork01 2022-10-14 10:09:54 +04:00
3 changed files with 4 additions and 6 deletions
Showing only changes of commit c2213d181e - Show all commits

View File

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

View File

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

View File

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