M.A. Zargarov Lab work 02 #2
@ -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>
|
||||
/// Установка позиции автобуса
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user