Лабораторная работа 1

This commit is contained in:
devil_1nc 2022-09-26 20:10:01 +04:00
parent 69b1fb0114
commit e936b4d813
3 changed files with 8 additions and 11 deletions

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>
/// Установка позиции самолета
@ -176,6 +175,7 @@ namespace ProjectPlane
// window
Brush brBlue = new SolidBrush(Color.LightBlue);
Brush brBlack = new SolidBrush(Color.Black);
Point[] Triangle3 = new Point[3];
Triangle3[0].X = Convert.ToInt32(_startPosX + 108); Triangle3[0].Y = Convert.ToInt32(_startPosY - 2);
@ -185,13 +185,11 @@ namespace ProjectPlane
g.DrawLine(pen, _startPosX + 37, _startPosY + 20, _startPosX + 37, _startPosY + 25);
g.DrawLine(pen, _startPosX + 32, _startPosY + 25, _startPosX + 40, _startPosY + 25);
g.DrawRectangle(pen, _startPosX + 32, _startPosY + 25, 3, 3);
g.DrawRectangle(pen, _startPosX + 39, _startPosY + 25, 3, 3);
g.FillRectangle(brBlack, _startPosX + 32, _startPosY + 25, 3, 3);
g.FillRectangle(brBlack, _startPosX + 39, _startPosY + 25, 3, 3);
g.DrawLine(pen, _startPosX + 102, _startPosY + 20, _startPosX + 102, _startPosY + 25);
g.DrawRectangle(pen, _startPosX + 101, _startPosY + 25, 3, 3);
Brush brBlack = new SolidBrush(Color.Black);
g.FillRectangle(brBlack, _startPosX + 101, _startPosY + 25, 3, 3);
g.FillRectangle(brBlack, _startPosX + 5, _startPosY - 2, 18, 7);
g.FillEllipse(brBlack, _startPosX, _startPosY - 2, 7, 7);

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