Исправление с 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="additionalColor">Дополнительный цвет</param>
/// <param name="wheels">Шасси</param>
/// <param name="rocket">Ракета</param>
public DrawingAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool rocket) : base(150, 93)
/// <param name="radar">Радар</param>
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)
@ -45,31 +45,27 @@ namespace ProjectAirplaneWithRadar.Drawnings
//Передняя стойка
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.FillEllipse(additionalBrush, _startPosX.Value + 92, _startPosY.Value + 85, 10, 10);
}
//_startPosY += 10;
_startPosY += 10;
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.FillRectangle(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 70, 2, 5);
g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value + 40, 10, 10);
g.FillRectangle(additionalBrush, _startPosX.Value + 70, _startPosY.Value + 40, 10, 10);
g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value + 70, 2, 5);
g.FillRectangle(additionalBrush, _startPosX.Value + 80, _startPosY.Value + 70, 2, 5);
g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 30, 50, 10);
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

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

View File

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