Исправление с BodyColor

This commit is contained in:
Павел Ладягин 2024-03-06 16:28:03 +04:00
parent e443f1f498
commit 28e4d143c3
3 changed files with 33 additions and 36 deletions

View File

@ -15,10 +15,10 @@ namespace ProjectAirplaneWithRadar.Drawnings
/// <param name="bodyColor">Основной цвет</param> /// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param> /// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="wheels">Шасси</param> /// <param name="wheels">Шасси</param>
/// <param name="rocket">Ракета</param> /// <param name="radar">Радар</param>
public DrawingAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool rocket) : base(150, 93) public DrawingAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool radar) : base(150, 93)
{ {
EntityAirplane = new EntityAirplaneWithRadar(speed, weight, bodyColor, additionalColor, wheels, rocket); EntityAirplane = new EntityAirplaneWithRadar(speed, weight, bodyColor, additionalColor, wheels, radar);
} }
public override void DrawTransport(Graphics g) public override void DrawTransport(Graphics g)
@ -45,31 +45,27 @@ namespace ProjectAirplaneWithRadar.Drawnings
//Передняя стойка //Передняя стойка
g.DrawRectangle(pen, _startPosX.Value + 95, _startPosY.Value + 80, 5, 10); g.DrawRectangle(pen, _startPosX.Value + 95, _startPosY.Value + 80, 5, 10);
g.FillRectangle(additionalBrush, _startPosX.Value + 95, _startPosY.Value + 80, 5, 10); g.FillRectangle(additionalBrush, _startPosX.Value + 95, _startPosY.Value +80, 5, 10);
g.DrawEllipse(pen, _startPosX.Value + 92, _startPosY.Value + 85, 10, 10); g.DrawEllipse(pen, _startPosX.Value + 92, _startPosY.Value + 85, 10, 10);
g.FillEllipse(additionalBrush, _startPosX.Value + 92, _startPosY.Value + 85, 10, 10); g.FillEllipse(additionalBrush, _startPosX.Value + 92, _startPosY.Value + 85, 10, 10);
} }
//_startPosY += 10; _startPosY += 10;
base.DrawTransport(g); base.DrawTransport(g);
//_startPosY -= 10; _startPosY -= 10;
//Ракета воздух-воздух //Радар
if (airplaneWithRadar.Rocket) if (airplaneWithRadar.Radar)
{ {
g.DrawRectangle(pen, _startPosX.Value + 50, _startPosY.Value + 70, 2, 5); g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value + 40, 10, 10);
g.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 70, 2, 5); g.FillRectangle(additionalBrush, _startPosX.Value + 70, _startPosY.Value + 40, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value + 70, 2, 5); g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 30, 50, 10);
g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 70, 2, 5); g.FillEllipse(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 30, 50, 10);
g.DrawRectangle(pen, _startPosX.Value + 40, _startPosY.Value + 75, 50, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 40, _startPosY.Value + 75, 50, 5);
} }
} }
} }
} }

View File

@ -229,39 +229,40 @@ namespace ProjectAirplaneWithRadar.Drawnings
Pen pen = new(Color.Black); Pen pen = new(Color.Black);
//Корпус //Корпус
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 50, 100, 30); g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 40, 100, 30);
//Хвост //Хвост
Point[] points = { Point[] points = {
new Point(_startPosX.Value + 10, _startPosY.Value), new Point(_startPosX.Value + 10, _startPosY.Value),
new Point(_startPosX.Value + 10, _startPosY.Value + 50), new Point(_startPosX.Value + 10, _startPosY.Value + 40),
new Point(_startPosX.Value + 50, _startPosY.Value + 50) new Point(_startPosX.Value + 50, _startPosY.Value + 40)
}; };
g.DrawPolygon(pen, points); g.DrawPolygon(pen, points);
//Кабина //Кабина
Point[] points2 = { Point[] points2 = {
new Point(_startPosX.Value + 110, _startPosY.Value + 45), new Point(_startPosX.Value + 110, _startPosY.Value + 35),
new Point(_startPosX.Value + 110, _startPosY.Value + 65), new Point(_startPosX.Value + 110, _startPosY.Value + 55),
new Point(_startPosX.Value + 150, _startPosY.Value + 65) new Point(_startPosX.Value + 150, _startPosY.Value + 55)
}; };
g.DrawPolygon(pen, points2); g.DrawPolygon(pen, points2);
Point[] points3 = { Point[] points3 = {
new Point(_startPosX.Value + 110, _startPosY.Value + 65), new Point(_startPosX.Value + 110, _startPosY.Value + 55),
new Point(_startPosX.Value + 110, _startPosY.Value + 85), new Point(_startPosX.Value + 110, _startPosY.Value + 75),
new Point(_startPosX.Value + 150, _startPosY.Value + 65) new Point(_startPosX.Value + 150, _startPosY.Value + 55)
}; };
g.DrawPolygon(pen, points3); g.DrawPolygon(pen, points3);
//Крыло //Крыло
Brush brBlack = new SolidBrush(Color.Black); Brush brBlack = new SolidBrush(EntityAirplane.BodyColor);
g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 60, 70, 10); g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 50, 70, 10);
g.FillEllipse(brBlack, _startPosX.Value + 30, _startPosY.Value + 60, 70, 10); g.FillEllipse(brBlack, _startPosX.Value + 30, _startPosY.Value + 50, 70, 10);
//Хвостовой элерон //Хвостовой элерон
g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 45, 30, 10); g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 35, 30, 10);
g.FillEllipse(brBlack, _startPosX.Value, _startPosY.Value + 45, 30, 10); g.FillEllipse(brBlack, _startPosX.Value, _startPosY.Value + 35, 30, 10);
} }
} }

View File

@ -18,7 +18,7 @@
/// <summary> /// <summary>
/// Признак (опция) наличия ракеты /// Признак (опция) наличия ракеты
/// </summary> /// </summary>
public bool Rocket { get; private set; } public bool Radar { get; private set; }
/// <summary> /// <summary>
/// Шаг перемещения автомобиля /// Шаг перемещения автомобиля
@ -33,12 +33,12 @@
/// <param name="bodyColor">Основной цвет</param> /// <param name="bodyColor">Основной цвет</param>
/// <param name="additionalColor">Дополнительный цвет</param> /// <param name="additionalColor">Дополнительный цвет</param>
/// <param name="wheels">Шасси</param> /// <param name="wheels">Шасси</param>
/// <param name="rocket">Ракета</param> /// <param name="radar">Радар</param>
public EntityAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool rocket) : base(speed, weight, bodyColor) public EntityAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool radar) : base(speed, weight, bodyColor)
{ {
AdditionalColor = additionalColor; AdditionalColor = additionalColor;
Wheels = wheels; Wheels = wheels;
Rocket = rocket; Radar = radar;
} }
} }
} }