PIbd_23_Kislitsa_E.D_AirFig.../AirFighter/DrawningAirFighter.cs
2023-10-02 20:42:00 +03:00

104 lines
4.2 KiB
C#

using ProjectAirFighter.Entities;
namespace ProjectAirFighter.DrawningObjects
{
public class DrawningAirFighter : DrawningAirplane
{
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)
{
if (EntityAirplane != null)
{
EntityAirplane = new EntityAirFighter(speed, weight, bodyColor, additionalColor, racket, wing);
}
}
public override void DrawTransport(Graphics g)
{
if (EntityAirplane is not EntityAirFighter airFighter)
{
return;
}
Brush additionalBrush = new SolidBrush(airFighter.AdditionalColor);
Pen pen = new(Color.Black);
base.DrawTransport(g);
if (airFighter.Racket)
{
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);
}
if (airFighter.Wing)
{
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);
}
}
}
}