Dolgov D.A. Lab Work 2 #2

Closed
devil_1nc wants to merge 10 commits from LabWork02 into LabWork01
3 changed files with 4 additions and 6 deletions
Showing only changes of commit 4f76d25f8d - Show all commits

View File

@ -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>
/// Установка позиции самолета

View File

@ -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;

View File

@ -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);