114 lines
4.4 KiB
C#
114 lines
4.4 KiB
C#
using ProjectAirFighter.Entities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
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 void ChangeAddColor(Color col)
|
|
{
|
|
((EntityAirFighter)EntityAirplane).AdditionalColor = col;
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
}
|