using System; using System.Collections.Generic; using System.Drawing.Drawing2D; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AirFighter { internal class DrawingMilitaryAircraft : DrawingAircraft { public DrawingMilitaryAircraft(int speed, float weight, Color bodyColor, Color extraColor, bool rockets, bool extraWings) : base(speed,weight,bodyColor, 100, 100) { Plane = new EntityMilitaryAircraft(speed, weight, bodyColor, extraColor, rockets, extraWings); } public override void DrawTransport(Graphics g) { if (Plane is not EntityMilitaryAircraft militaryAircraft) { return; } Pen pen = new(Color.Black); Brush extraBrush = new SolidBrush(militaryAircraft.ExtraColor); base.DrawTransport(g); if (militaryAircraft.ExtraWings) { GraphicsPath pathExtraWing1 = new GraphicsPath(); Point point1W1 = new Point((int)(_startPosX + 30), (int)(_startPosY + 45)); Point point2W1 = new Point(point1W1.X , point1W1.Y - 40); Point point3W1 = new Point(point2W1.X + 10,point1W1.Y); Point[] pointsExtraWing1 = new Point[] { point1W1,point2W1,point3W1}; pathExtraWing1.AddLines(pointsExtraWing1); g.DrawPath(pen, pathExtraWing1); g.FillPath(extraBrush, pathExtraWing1); GraphicsPath pathExtraWing2 = new GraphicsPath(); Point point1W2 = new Point((int)(_startPosX + 30),(int)(_startPosY + 60)); Point point2W2 = new Point(point1W2.X , point1W2.Y + 40); Point point3W3 = new Point(point2W2.X + 10,point1W2.Y); Point[] pointsExtraWing2 = new Point[] {point1W2,point2W2,point3W3}; pathExtraWing2.AddLines(pointsExtraWing2); g.DrawPath(pen, pathExtraWing2); g.FillPath(extraBrush, pathExtraWing2); } if (militaryAircraft.Rockets) { g.DrawRectangle(pen, _startPosX + 50, _startPosY + 30,17,4); GraphicsPath pathRocketHead1 = new GraphicsPath(); Point point1R1 = new Point((int)(_startPosX + 50),(int)(_startPosY + 30)); Point point2R1 = new Point(point1R1.X - 5,point1R1.Y + 2); Point point3R1 = new Point(point1R1.X , point1R1.Y + 4); Point[] pointsExtraRocketHead1 = new Point[] { point1R1, point2R1, point3R1 }; pathRocketHead1.AddLines(pointsExtraRocketHead1); g.DrawPath(pen, pathRocketHead1); g.FillPath(extraBrush, pathRocketHead1); g.DrawRectangle(pen, _startPosX + 50, _startPosY + 70, 17, 4); GraphicsPath pathRocketHead2 = new GraphicsPath(); Point point1R2 = new Point((int)(_startPosX + 50),(int)(_startPosY + 70)); Point point2R2 = new Point(point1R2.X - 5,point1R2.Y + 2); Point point3R2 = new Point(point1R2.X, point1R2.Y + 4); Point[] pointsExtraRocketHead2 = new Point[] { point1R2, point2R2, point3R2 }; pathRocketHead2.AddLines(pointsExtraRocketHead2); g.DrawPath(pen, pathRocketHead2); g.FillPath(extraBrush, pathRocketHead2); } } } }