Правка

This commit is contained in:
Danil Kargin 2022-10-05 22:46:17 +04:00
parent f0e50f2758
commit 6eb0ae0dc9
2 changed files with 4 additions and 5 deletions

View File

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

View File

@ -26,9 +26,7 @@ namespace AirFighter
{ {
_airFighter = new DrawningAirFighter(); _airFighter = new DrawningAirFighter();
Random rnd = new Random(); Random rnd = new Random();
EntityAirFighter entityAirFighter = new EntityAirFighter(); _airFighter.Init(rnd.Next(200, 500), rnd.Next(2000, 5000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
entityAirFighter?.Init(rnd.Next(200, 500), rnd.Next(2000, 5000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_airFighter.Init(entityAirFighter);
_airFighter.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height); _airFighter.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü: {_airFighter.AirFighter?.Speed}"; toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü: {_airFighter.AirFighter?.Speed}";
toolStripStatusLabelWeight.Text = $"Âåñ: {_airFighter.AirFighter?.Weight}"; toolStripStatusLabelWeight.Text = $"Âåñ: {_airFighter.AirFighter?.Weight}";