diff --git a/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs index e213dc6..274c5f4 100644 --- a/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs +++ b/AntiAircraftGun/AntiAircraftGun/DrawingAntiAircraftGun.cs @@ -45,10 +45,9 @@ namespace AntiAircraftGun /// Скорость /// Вес зенитного орудия /// Цвет корпуса - public void Init(int speed, float weight, Color bodyColor) + public DrawingAntiAircraftGun(int speed, float weight, Color bodyColor) { - AntiAircraftGun = new EntityAntiAircraftGun(); - AntiAircraftGun.Init(speed, weight, bodyColor); + AntiAircraftGun = new EntityAntiAircraftGun(speed, weight, bodyColor); } /// /// Установка позиции зенитного орудия diff --git a/AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs index f81d3d8..a9705c9 100644 --- a/AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs +++ b/AntiAircraftGun/AntiAircraftGun/EntityAntiAircraftGun.cs @@ -31,7 +31,7 @@ namespace AntiAircraftGun /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityAntiAircraftGun(int speed, float weight, Color bodyColor) { Random rnd = new(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs b/AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs index a3430d4..f4902d0 100644 --- a/AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs +++ b/AntiAircraftGun/AntiAircraftGun/FormAntiAircraftGun.cs @@ -32,8 +32,7 @@ namespace AntiAircraftGun private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _antiAircrafGun = new DrawingAntiAircraftGun(); - _antiAircrafGun.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), + _antiAircrafGun = new DrawingAntiAircraftGun(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _antiAircrafGun.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height);