75 lines
3.3 KiB
C#
75 lines
3.3 KiB
C#
|
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>
|
|||
|
/// <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);
|
|||
|
}
|
|||
|
|
|||
|
/// <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);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|