From 91aaf22ac6b7831441025d53d3a4f9fa01f1e21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9C=D0=B0=D1=80=D0=B0=D1=82=20=D0=97=D0=B0=D1=80=D0=B3?= =?UTF-8?q?=D0=B0=D1=80=D0=BE=D0=B2?= Date: Mon, 3 Oct 2022 21:09:35 +0400 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D1=85=D0=BE=D0=B4=20?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D1=80=D1=83=D0=BA?= =?UTF-8?q?=D1=82=D0=BE=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DoubleDeckerBus/DoubleDeckerBus/DrawningBus.cs | 5 ++--- DoubleDeckerBus/DoubleDeckerBus/EntityBus.cs | 2 +- DoubleDeckerBus/DoubleDeckerBus/FormBus.cs | 3 +-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/DoubleDeckerBus/DoubleDeckerBus/DrawningBus.cs b/DoubleDeckerBus/DoubleDeckerBus/DrawningBus.cs index c51638b..58e332d 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/DrawningBus.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/DrawningBus.cs @@ -45,10 +45,9 @@ namespace DoubleDeckerBus /// Скорость /// Вес автобуса /// Цвет кузова - 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); } /// /// Установка позиции автобуса diff --git a/DoubleDeckerBus/DoubleDeckerBus/EntityBus.cs b/DoubleDeckerBus/DoubleDeckerBus/EntityBus.cs index e04fa53..74ace8c 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/EntityBus.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/EntityBus.cs @@ -34,7 +34,7 @@ namespace DoubleDeckerBus /// /// /// - 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; diff --git a/DoubleDeckerBus/DoubleDeckerBus/FormBus.cs b/DoubleDeckerBus/DoubleDeckerBus/FormBus.cs index 90c0c0e..11caede 100644 --- a/DoubleDeckerBus/DoubleDeckerBus/FormBus.cs +++ b/DoubleDeckerBus/DoubleDeckerBus/FormBus.cs @@ -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);