2024-03-01 19:55:24 +04:00
|
|
|
|
using ProjectAirplaneWithRadar.Entities;
|
|
|
|
|
|
|
|
|
|
namespace ProjectAirplaneWithRadar.Drawnings
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DrawingAirplaneWithRadar : DrawningAirplane
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Инициализация свойств
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="speed">Скорость</param>
|
|
|
|
|
/// <param name="weight">Вес</param>
|
|
|
|
|
/// <param name="bodyColor">Основной цвет</param>
|
|
|
|
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
|
|
|
/// <param name="wheels">Шасси</param>
|
2024-03-06 16:28:03 +04:00
|
|
|
|
/// <param name="radar">Радар</param>
|
|
|
|
|
public DrawingAirplaneWithRadar(int speed, double weight, Color bodyColor, Color additionalColor, bool wheels, bool radar) : base(150, 93)
|
2024-03-01 19:55:24 +04:00
|
|
|
|
{
|
2024-03-06 16:28:03 +04:00
|
|
|
|
EntityAirplane = new EntityAirplaneWithRadar(speed, weight, bodyColor, additionalColor, wheels, radar);
|
2024-03-01 19:55:24 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void DrawTransport(Graphics g)
|
|
|
|
|
{
|
|
|
|
|
if (EntityAirplane == null || EntityAirplane is not EntityAirplaneWithRadar airplaneWithRadar || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Pen pen = new(Color.Black);
|
|
|
|
|
Brush additionalBrush = new SolidBrush(airplaneWithRadar.AdditionalColor);
|
|
|
|
|
|
|
|
|
|
if (airplaneWithRadar.Wheels)
|
|
|
|
|
{
|
|
|
|
|
//Задняя стойка
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 30, _startPosY.Value + 80, 5, 10);
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 30, _startPosY.Value + 80, 5, 10);
|
|
|
|
|
|
|
|
|
|
g.DrawEllipse(pen, _startPosX.Value + 20, _startPosY.Value + 85, 10, 10);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 20, _startPosY.Value + 85, 10, 10);
|
|
|
|
|
|
|
|
|
|
g.DrawEllipse(pen, _startPosX.Value + 35, _startPosY.Value + 85, 10, 10);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 35, _startPosY.Value + 85, 10, 10);
|
|
|
|
|
|
|
|
|
|
//Передняя стойка
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 95, _startPosY.Value + 80, 5, 10);
|
2024-03-06 16:28:03 +04:00
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 95, _startPosY.Value +80, 5, 10);
|
2024-03-01 19:55:24 +04:00
|
|
|
|
|
|
|
|
|
g.DrawEllipse(pen, _startPosX.Value + 92, _startPosY.Value + 85, 10, 10);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 92, _startPosY.Value + 85, 10, 10);
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-06 16:28:03 +04:00
|
|
|
|
_startPosY += 10;
|
2024-03-01 19:55:24 +04:00
|
|
|
|
base.DrawTransport(g);
|
2024-03-06 16:28:03 +04:00
|
|
|
|
_startPosY -= 10;
|
2024-03-01 19:55:24 +04:00
|
|
|
|
|
|
|
|
|
|
2024-03-06 16:28:03 +04:00
|
|
|
|
//Радар
|
|
|
|
|
if (airplaneWithRadar.Radar)
|
2024-03-01 19:55:24 +04:00
|
|
|
|
{
|
2024-03-06 16:28:03 +04:00
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value + 40, 10, 10);
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 70, _startPosY.Value + 40, 10, 10);
|
2024-03-01 19:55:24 +04:00
|
|
|
|
|
2024-03-06 16:28:03 +04:00
|
|
|
|
g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 30, 50, 10);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 30, 50, 10);
|
|
|
|
|
}
|
2024-03-01 19:55:24 +04:00
|
|
|
|
|
2024-03-06 16:28:03 +04:00
|
|
|
|
}
|
2024-03-01 19:55:24 +04:00
|
|
|
|
}
|
|
|
|
|
}
|