2024-03-23 15:26:35 +04:00
|
|
|
|
using ProjectAirplaneWithRadar.Entities;
|
|
|
|
|
|
|
|
|
|
namespace ProjectAirplaneWithRadar.Drawnings
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
|
|
|
|
/// </summary>
|
|
|
|
|
public class DrawingAirplaneWithRadar : DrawningAirplane
|
2024-04-14 12:12:24 +04:00
|
|
|
|
{
|
2024-03-23 15:26:35 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Инициализация свойств
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="speed">Скорость</param>
|
|
|
|
|
/// <param name="weight">Вес</param>
|
|
|
|
|
/// <param name="bodyColor">Основной цвет</param>
|
|
|
|
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
|
|
|
/// <param name="wheels">Шасси</param>
|
|
|
|
|
/// <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, radar);
|
|
|
|
|
}
|
|
|
|
|
|
2024-04-14 12:12:24 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Конструктор для метода создания объекта из строки (ExtentionDrawningAirplane)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="airplane"></param>
|
|
|
|
|
public DrawingAirplaneWithRadar(EntityAirplane? airplane) : base(airplane)
|
|
|
|
|
{
|
|
|
|
|
if (airplane != null)
|
|
|
|
|
EntityAirplane = airplane;
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-23 15:26:35 +04:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Прорисовка объекта
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="g"></param>
|
|
|
|
|
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);
|
|
|
|
|
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;
|
|
|
|
|
base.DrawTransport(g);
|
|
|
|
|
_startPosY -= 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//Радар
|
|
|
|
|
if (airplaneWithRadar.Radar)
|
|
|
|
|
{
|
|
|
|
|
g.DrawRectangle(pen, _startPosX.Value + 70, _startPosY.Value + 40, 10, 10);
|
|
|
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 70, _startPosY.Value + 40, 10, 10);
|
|
|
|
|
|
|
|
|
|
g.DrawEllipse(pen, _startPosX.Value + 50, _startPosY.Value + 30, 50, 10);
|
|
|
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 50, _startPosY.Value + 30, 50, 10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|