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

This commit is contained in:
Adelina888 2024-02-19 19:18:37 +04:00
parent a8bf415748
commit c54bcb4c19

View File

@ -171,42 +171,63 @@ public class DrawingStormtrooper
return; return;
} }
Pen pen = new(Color.Black); Pen pen = new (Color.Black);
Brush bodyColorBrush = new SolidBrush(EntityStormtrooper.BodyColor); Brush bodyColorBrush = new SolidBrush(EntityStormtrooper.BodyColor);
Brush additionalBrush = new SolidBrush(EntityStormtrooper.AdditionalColor); Brush additionalBrush = new SolidBrush(EntityStormtrooper.AdditionalColor);
//нос штурмовика //нос штурмовика
Brush brBlack = new SolidBrush(Color.Black);
Point[] Nose = new Point[3]; Point[] Nose = new Point[3];
Nose[0].X = _startPosX.Value + 20; Nose[0].Y = _startPosY.Value + 80; Nose[0].X = _startPosX.Value + 20; Nose[0].Y = _startPosY.Value + 80;
Nose[1].X = _startPosX.Value + 20; Nose[1].Y = _startPosY.Value + 60; Nose[1].X = _startPosX.Value + 20; Nose[1].Y = _startPosY.Value + 60;
Nose[2].X = _startPosX.Value; Nose[2].Y = _startPosY.Value + 70; Nose[2].X = _startPosX.Value; Nose[2].Y = _startPosY.Value + 70;
g.FillPolygon(bodyColorBrush, Nose); g.FillPolygon(brBlack, Nose);
g.DrawPolygon(pen, Nose);
//Заднии крылья штурмовика
Point[] pflybtwings = new Point[6];
pflybtwings[0].X = _startPosX.Value + 120; pflybtwings[0].Y = _startPosY.Value + 60;
pflybtwings[1].X = _startPosX.Value + 120; pflybtwings[1].Y = _startPosY.Value + 50;
pflybtwings[2].X = _startPosX.Value + 140; pflybtwings[2].Y = _startPosY.Value + 30;
pflybtwings[3].X = _startPosX.Value + 140; pflybtwings[3].Y = _startPosY.Value + 110;
pflybtwings[4].X = _startPosX.Value + 120; pflybtwings[4].Y = _startPosY.Value + 90;
pflybtwings[5].X = _startPosX.Value + 120; pflybtwings[5].Y = _startPosY.Value + 80;
g.FillPolygon(bodyColorBrush, pflybtwings);
g.DrawPolygon(pen, pflybtwings);
//Тело штурмовика //Тело штурмовика
g.FillRectangle(bodyColorBrush, _startPosX.Value + 20, _startPosY.Value + 60, 120, 20);
g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 60, 120, 20); g.DrawRectangle(pen, _startPosX.Value + 20, _startPosY.Value + 60, 120, 20);
//Крылья штурмовика //Крылья штурмовика
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 60, _startPosX.Value + 60, _startPosY.Value);
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value, _startPosX.Value + 70, _startPosY.Value);
g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value, _startPosX.Value + 80, _startPosY.Value + 60);
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 80, _startPosX.Value + 60, _startPosY.Value+140); Point[] frontwings = new Point[4];
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value+140, _startPosX.Value + 70, _startPosY.Value+140); frontwings[0].X = _startPosX.Value + 60; frontwings[0].Y = _startPosY.Value + 60;
g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value+140, _startPosX.Value + 80, _startPosY.Value + 80); frontwings[1].X = _startPosX.Value + 60; frontwings[1].Y = _startPosY.Value ;
frontwings[2].X = _startPosX.Value + 70; frontwings[2].Y = _startPosY.Value ;
frontwings[3].X = _startPosX.Value + 80; frontwings[3].Y = _startPosY.Value + 60;
g.FillPolygon(bodyColorBrush, frontwings);
g.DrawPolygon(pen, frontwings);
Point[] frontwings2 = new Point[4];
frontwings2[0].X = _startPosX.Value + 60; frontwings2[0].Y = _startPosY.Value + 80;
frontwings2[1].X = _startPosX.Value + 60; frontwings2[1].Y = _startPosY.Value+140;
frontwings2[2].X = _startPosX.Value + 70; frontwings2[2].Y = _startPosY.Value+140;
frontwings2[3].X = _startPosX.Value + 80; frontwings2[3].Y = _startPosY.Value + 80;
g.FillPolygon(bodyColorBrush, frontwings2);
g.DrawPolygon(pen, frontwings2);
//Заднии крылья штурмовика
g.DrawLine(pen, _startPosX.Value + 120, _startPosY.Value + 60, _startPosX.Value + 120, _startPosY.Value + 50);
g.DrawLine(pen, _startPosX.Value + 120, _startPosY.Value + 50, _startPosX.Value + 140, _startPosY.Value + 30);
g.DrawLine(pen, _startPosX.Value + 140, _startPosY.Value + 30, _startPosX.Value + 140, _startPosY.Value + 110);
g.DrawLine(pen, _startPosX.Value + 140, _startPosY.Value + 110, _startPosX.Value + 120, _startPosY.Value + 90);
g.DrawLine(pen, _startPosX.Value + 120, _startPosY.Value + 90, _startPosX.Value + 120, _startPosY.Value + 80);
//Ракеты штурмовика //Ракеты штурмовика
if (EntityStormtrooper.Rockets) if (EntityStormtrooper.Rockets)
{ {
g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 20, 15, 5); g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 20, 15, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 110, 15, 5); g.FillRectangle(additionalBrush, _startPosX.Value + 45, _startPosY.Value + 110, 15, 5);
g.DrawRectangle(pen, _startPosX.Value + 45, _startPosY.Value + 20, 15, 5);
g.DrawRectangle(pen, _startPosX.Value + 45, _startPosY.Value + 110, 15, 5);
} }
//Бомбы бомбардировщика //Бомбы бомбардировщика
@ -214,6 +235,9 @@ public class DrawingStormtrooper
{ {
g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 40, 10, 10); g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 40, 10, 10);
g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 90, 10, 10); g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 90, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 40, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 90, 10, 10);
} }
} }