Лаборатная работа 1
This commit is contained in:
parent
e936b4d813
commit
b66671fd10
@ -51,9 +51,10 @@ namespace ProjectPlane
|
|||||||
/// <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 DrawingPlane(int speed, float weight, Color bodyColor)
|
public void Init(int speed, float weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
Plane = new EntityPlane(speed, weight, bodyColor);
|
Plane = new EntityPlane();
|
||||||
|
Plane.Init(speed, weight, bodyColor);
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Установка позиции самолета
|
/// Установка позиции самолета
|
||||||
|
@ -32,7 +32,7 @@ namespace ProjectPlane
|
|||||||
/// <param name="weight"></param>
|
/// <param name="weight"></param>
|
||||||
/// <param name="bodyColor"></param>
|
/// <param name="bodyColor"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public EntityPlane(int speed, float weight, Color bodyColor)
|
public void Init(int speed, float weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
Random rnd = new();
|
Random rnd = new();
|
||||||
Speed = speed <= 0 ? rnd.Next(350, 550) : speed;
|
Speed = speed <= 0 ? rnd.Next(350, 550) : speed;
|
||||||
|
@ -48,7 +48,8 @@
|
|||||||
private void buttonCreate_Click(object sender, EventArgs e)
|
private void buttonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random rand = new Random();
|
Random rand = new Random();
|
||||||
_plane = new DrawingPlane(rand.Next(200, 500), rand.Next(2000, 3000),
|
_plane = new DrawingPlane();
|
||||||
|
_plane.Init(rand.Next(200, 500), rand.Next(2000, 3000),
|
||||||
Color.FromArgb(rand.Next(0, 256), rand.Next(0, 256), rand.Next(0, 256)));
|
Color.FromArgb(rand.Next(0, 256), rand.Next(0, 256), rand.Next(0, 256)));
|
||||||
_plane.SetPosition(rand.Next(5, 100), rand.Next(40, 100),
|
_plane.SetPosition(rand.Next(5, 100), rand.Next(40, 100),
|
||||||
pictureBoxPlane.Width, pictureBoxPlane.Height);
|
pictureBoxPlane.Width, pictureBoxPlane.Height);
|
||||||
|
Loading…
Reference in New Issue
Block a user