PIbd_23_Kislitsa_E.D_AirFig.../AirFighter/DrawningAirFighter.cs

104 lines
4.2 KiB
C#
Raw Permalink Normal View History

2023-10-02 21:42:00 +04:00
using ProjectAirFighter.Entities;
2023-09-21 18:40:56 +04:00
2023-10-02 21:42:00 +04:00
namespace ProjectAirFighter.DrawningObjects
2023-09-21 18:40:56 +04:00
{
2023-10-02 21:42:00 +04:00
public class DrawningAirFighter : DrawningAirplane
2023-09-21 18:40:56 +04:00
{
2023-10-02 21:42:00 +04:00
public DrawningAirFighter(int speed, double weight, Color bodyColor, Color
additionalColor, bool racket, bool wing, int width, int height) :
base(speed, weight, bodyColor, width, height, 160, 160)
2023-09-21 18:40:56 +04:00
{
2023-10-02 21:42:00 +04:00
if (EntityAirplane != null)
2023-09-21 18:40:56 +04:00
{
2023-10-02 21:42:00 +04:00
EntityAirplane = new EntityAirFighter(speed, weight, bodyColor, additionalColor, racket, wing);
2023-09-21 18:40:56 +04:00
}
}
2023-10-02 21:42:00 +04:00
public override void DrawTransport(Graphics g)
2023-09-21 18:40:56 +04:00
{
2023-10-02 21:42:00 +04:00
if (EntityAirplane is not EntityAirFighter airFighter)
2023-09-21 18:40:56 +04:00
{
return;
}
2023-10-02 21:42:00 +04:00
Brush additionalBrush = new SolidBrush(airFighter.AdditionalColor);
2023-09-21 18:40:56 +04:00
Pen pen = new(Color.Black);
2023-10-02 21:42:00 +04:00
base.DrawTransport(g);
if (airFighter.Racket)
2023-09-21 18:40:56 +04:00
{
Brush brGrey = new SolidBrush(Color.LightGray);
g.FillRectangle(brGrey, _startPosX + 70, _startPosY - 15, 10, 10);
g.DrawRectangle(pen, _startPosX + 70, _startPosY - 15, 10, 10);
Point[] noseracketPoints =
{
new Point(_startPosX + 70, _startPosY -5),
new Point(_startPosX + 70, _startPosY - 15),
new Point(_startPosX + 60,_startPosY -10)
};
Brush brRed = new SolidBrush(Color.Red);
g.FillPolygon(brRed, noseracketPoints);
g.DrawPolygon(pen, noseracketPoints);
g.FillRectangle(brGrey, _startPosX + 70, _startPosY - 40, 10, 10);
g.DrawRectangle(pen, _startPosX + 70, _startPosY - 40, 10, 10);
Point[] noseracketPoints2 =
{
new Point(_startPosX + 70, _startPosY -30),
new Point(_startPosX + 70, _startPosY - 40),
new Point(_startPosX + 60,_startPosY -35)
};
g.FillPolygon(brRed, noseracketPoints2);
g.DrawPolygon(pen, noseracketPoints2);
g.FillPolygon(brRed, noseracketPoints);
g.DrawPolygon(pen, noseracketPoints);
g.FillRectangle(brGrey, _startPosX + 70, _startPosY + 59, 10, 10);
g.DrawRectangle(pen, _startPosX + 70, _startPosY + 59, 10, 10);
Point[] noseracketPoints3 =
{
new Point(_startPosX + 70, _startPosY +59),
new Point(_startPosX + 70, _startPosY + 69),
new Point(_startPosX + 60,_startPosY + 64)
};
g.FillPolygon(brRed, noseracketPoints3);
g.DrawPolygon(pen, noseracketPoints3);
g.FillRectangle(brGrey, _startPosX + 70, _startPosY + 34, 10, 10);
g.DrawRectangle(pen, _startPosX + 70, _startPosY + 34, 10, 10);
Point[] noseracketPoints4 =
{
new Point(_startPosX + 70, _startPosY +34),
new Point(_startPosX + 70, _startPosY + 44),
new Point(_startPosX + 60,_startPosY + 39)
};
g.FillPolygon(brRed, noseracketPoints4);
g.DrawPolygon(pen, noseracketPoints4);
}
2023-10-02 21:42:00 +04:00
if (airFighter.Wing)
2023-09-21 18:40:56 +04:00
{
Point[] doprightwingPoints =
{
new Point(_startPosX + 30, _startPosY + 4),
new Point(_startPosX+30,_startPosY - 34),
new Point(_startPosX+35,_startPosY - 34),
new Point(_startPosX + 45, _startPosY + 4)
};
g.FillPolygon(additionalBrush, doprightwingPoints);
g.DrawPolygon(pen, doprightwingPoints);
Point[] doplefttwingPoints =
{
new Point(_startPosX + 30, _startPosY + 24),
new Point(_startPosX + 30, _startPosY + 59),
new Point(_startPosX+35,_startPosY + 59),
new Point(_startPosX+45,_startPosY + 24)
};
g.FillPolygon(additionalBrush, doplefttwingPoints);
g.DrawPolygon(pen, doplefttwingPoints);
}
}
}
2023-10-02 21:42:00 +04:00
}