Лабораторная работа 1
This commit is contained in:
parent
69b1fb0114
commit
e936b4d813
@ -51,10 +51,9 @@ 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 void Init(int speed, float weight, Color bodyColor)
|
public DrawingPlane(int speed, float weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
Plane = new EntityPlane();
|
Plane = new EntityPlane(speed, weight, bodyColor);
|
||||||
Plane.Init(speed, weight, bodyColor);
|
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Установка позиции самолета
|
/// Установка позиции самолета
|
||||||
@ -176,6 +175,7 @@ namespace ProjectPlane
|
|||||||
// window
|
// window
|
||||||
|
|
||||||
Brush brBlue = new SolidBrush(Color.LightBlue);
|
Brush brBlue = new SolidBrush(Color.LightBlue);
|
||||||
|
Brush brBlack = new SolidBrush(Color.Black);
|
||||||
|
|
||||||
Point[] Triangle3 = new Point[3];
|
Point[] Triangle3 = new Point[3];
|
||||||
Triangle3[0].X = Convert.ToInt32(_startPosX + 108); Triangle3[0].Y = Convert.ToInt32(_startPosY - 2);
|
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 + 37, _startPosY + 20, _startPosX + 37, _startPosY + 25);
|
||||||
g.DrawLine(pen, _startPosX + 32, _startPosY + 25, _startPosX + 40, _startPosY + 25);
|
g.DrawLine(pen, _startPosX + 32, _startPosY + 25, _startPosX + 40, _startPosY + 25);
|
||||||
g.DrawRectangle(pen, _startPosX + 32, _startPosY + 25, 3, 3);
|
g.FillRectangle(brBlack, _startPosX + 32, _startPosY + 25, 3, 3);
|
||||||
g.DrawRectangle(pen, _startPosX + 39, _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.DrawLine(pen, _startPosX + 102, _startPosY + 20, _startPosX + 102, _startPosY + 25);
|
||||||
g.DrawRectangle(pen, _startPosX + 101, _startPosY + 25, 3, 3);
|
g.FillRectangle(brBlack, _startPosX + 101, _startPosY + 25, 3, 3);
|
||||||
|
|
||||||
Brush brBlack = new SolidBrush(Color.Black);
|
|
||||||
|
|
||||||
g.FillRectangle(brBlack, _startPosX + 5, _startPosY - 2, 18, 7);
|
g.FillRectangle(brBlack, _startPosX + 5, _startPosY - 2, 18, 7);
|
||||||
g.FillEllipse(brBlack, _startPosX, _startPosY - 2, 7, 7);
|
g.FillEllipse(brBlack, _startPosX, _startPosY - 2, 7, 7);
|
||||||
|
@ -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 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(350, 550) : speed;
|
Speed = speed <= 0 ? rnd.Next(350, 550) : speed;
|
||||||
|
@ -48,8 +48,7 @@
|
|||||||
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();
|
_plane = new DrawingPlane(rand.Next(200, 500), rand.Next(2000, 3000),
|
||||||
_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