diff --git a/Stormtrooper/Stormtrooper/Drawning.cs b/Stormtrooper/Stormtrooper/Drawning.cs index 93f4666..b854878 100644 --- a/Stormtrooper/Stormtrooper/Drawning.cs +++ b/Stormtrooper/Stormtrooper/Drawning.cs @@ -45,10 +45,9 @@ namespace Stormtrooper /// Скорость /// Вес самолёта /// Цвет кузова - public void Init(int speed, float weight, Color bodyColor) + public Drawning(int speed, float weight, Color bodyColor) { - Storm = new EntityStormtrooper(); - Storm.Init(speed, weight, bodyColor); + Storm = new EntityStormtrooper(speed, weight, bodyColor); } /// /// Установка позиции самолёта diff --git a/Stormtrooper/Stormtrooper/EntityStormtrooper.cs b/Stormtrooper/Stormtrooper/EntityStormtrooper.cs index 825e787..0d0be1f 100644 --- a/Stormtrooper/Stormtrooper/EntityStormtrooper.cs +++ b/Stormtrooper/Stormtrooper/EntityStormtrooper.cs @@ -34,7 +34,7 @@ namespace Stormtrooper /// /// /// - public void Init(int speed, float weight, Color bodyColor) + public EntityStormtrooper(int speed, float weight, Color bodyColor) { Random rnd = new Random(); Speed = speed <= 0 ? rnd.Next(50, 150) : speed; diff --git a/Stormtrooper/Stormtrooper/FormStormtrooper.cs b/Stormtrooper/Stormtrooper/FormStormtrooper.cs index a8633d4..0f56a4e 100644 --- a/Stormtrooper/Stormtrooper/FormStormtrooper.cs +++ b/Stormtrooper/Stormtrooper/FormStormtrooper.cs @@ -27,8 +27,7 @@ namespace Stormtrooper private void ButtonCreate_Click(object sender, EventArgs e) { Random rnd = new(); - _storm = new Drawning(); - _storm.Init(rnd.Next(100,300), rnd.Next(1000,2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); + _storm = new Drawning(rnd.Next(100,300), rnd.Next(1000,2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256))); _storm.SetPosition(rnd.Next(0, 150), rnd.Next(0, 300), pictureBoxStormtrooper.Width, pictureBoxStormtrooper.Height); toolStripStatusLabelSpeed.Text = $": {_storm.Storm.Speed}"; toolStripStatusLabelWeight.Text = $": {_storm.Storm.Weight}";