M.A. Zargarov Lab work 02 #2

Closed
klllst wants to merge 7 commits from LabWork02 into LabWork01
3 changed files with 4 additions and 6 deletions
Showing only changes of commit 91aaf22ac6 - Show all commits

View File

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

View File

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

View File

@ -24,8 +24,7 @@ namespace DoubleDeckerBus
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
_bus = new DrawningBus();
_bus.Init(rnd.Next(100, 300), rnd.Next(1000, 2000),
_bus = new DrawningBus(rnd.Next(100, 300), rnd.Next(1000, 2000),
Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_bus.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100),
pictureBoxBus.Width, pictureBoxBus.Height);