Dolgov D.A. Lab Work 2 #2
@ -51,10 +51,9 @@ namespace ProjectPlane
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес самолета</param>
|
||||
/// <param name="bodyColor">Цвет корпуса</param>
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public DrawingPlane(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Plane = new EntityPlane();
|
||||
Plane.Init(speed, weight, bodyColor);
|
||||
Plane = new EntityPlane(speed, weight, bodyColor);
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка позиции самолета
|
@ -32,7 +32,7 @@ namespace ProjectPlane
|
||||
/// <param name="weight"></param>
|
||||
/// <param name="bodyColor"></param>
|
||||
/// <returns></returns>
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public EntityPlane(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Random rnd = new();
|
||||
Speed = speed <= 0 ? rnd.Next(350, 550) : speed;
|
||||
|
@ -48,8 +48,7 @@
|
||||
private void buttonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rand = new Random();
|
||||
_plane = new DrawingPlane();
|
||||
_plane.Init(rand.Next(200, 500), rand.Next(2000, 3000),
|
||||
_plane = new DrawingPlane(rand.Next(200, 500), rand.Next(2000, 3000),
|
||||
Color.FromArgb(rand.Next(0, 256), rand.Next(0, 256), rand.Next(0, 256)));
|
||||
_plane.SetPosition(rand.Next(5, 100), rand.Next(40, 100),
|
||||
pictureBoxPlane.Width, pictureBoxPlane.Height);
|
||||
|
Loading…
Reference in New Issue
Block a user