Переходы на конструкторы
This commit is contained in:
parent
dd086e5c0b
commit
928fa3a1df
@ -45,10 +45,10 @@ namespace Airbus
|
|||||||
/// <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(int speed, float weight, Color bodyColor)
|
public DrawningPlane(int speed, float weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
Plane = new EntityPlane();
|
Plane = new EntityPlane(speed, weight, bodyColor);
|
||||||
Plane.Init(speed, weight, bodyColor);
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Установка позиции самолета
|
/// Установка позиции самолета
|
||||||
|
@ -31,7 +31,7 @@ namespace Airbus
|
|||||||
/// <param name="weight"></param>
|
/// <param name="weight"></param>
|
||||||
/// <param name="bodyColor"></param>
|
/// <param name="bodyColor"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public void Init(int speed, float weight, Color bodyColor)
|
public EntityPlane(int speed, float weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
Speed = speed <= 0 ? rnd.Next(50, 150) : speed;
|
Speed = speed <= 0 ? rnd.Next(50, 150) : speed;
|
||||||
|
@ -37,8 +37,7 @@ namespace Airbus
|
|||||||
{
|
{
|
||||||
|
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
_plane = new DrawningPlane();
|
_plane = new DrawningPlane(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||||
_plane.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
|
||||||
_plane.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirbus.Width, pictureBoxAirbus.Height);
|
_plane.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxAirbus.Width, pictureBoxAirbus.Height);
|
||||||
toolStripStatusLabelSpeed.Text = $"Скорость: {_plane.Plane.Speed}";
|
toolStripStatusLabelSpeed.Text = $"Скорость: {_plane.Plane.Speed}";
|
||||||
toolStripStatusLabelWeight.Text = $"Вес: {_plane.Plane.Weight}";
|
toolStripStatusLabelWeight.Text = $"Вес: {_plane.Plane.Weight}";
|
||||||
|
Loading…
Reference in New Issue
Block a user