63 lines
2.8 KiB
C#
63 lines
2.8 KiB
C#
using AntiAircraftGun.Entities;
|
||
|
||
namespace AntiAircraftGun.Drawnings;
|
||
/// <summary>
|
||
/// Класс отвечающий за прорисовку и перемещение объекта - сущности
|
||
/// </summary>
|
||
public class DrawningAntiAircraftGun : DrawningAircraftGun
|
||
{
|
||
/// <summary>
|
||
/// Конструктор
|
||
/// </summary>
|
||
/// <param name="speed">Скорость</param>
|
||
/// <param name="weight">Вес</param>
|
||
/// <param name="bodyColor">Основной цвет</param>
|
||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||
/// <param name="tower">Признак наличия башни</param>
|
||
/// <param name="radar">Признак наличия радара</param>
|
||
|
||
public DrawningAntiAircraftGun(int speed, double weight, Color bodyColor, Color additionalColor, bool radar, bool tower) : base(129, 105)
|
||
{
|
||
EntityAircraftGun = new EntityAntiAircraftGun(speed, weight, bodyColor, radar, tower, additionalColor);
|
||
}
|
||
/// <summary>
|
||
/// Прорисовка объекта
|
||
/// </summary>
|
||
/// <param name="g"></param>
|
||
public override void DrawTransport(Graphics g)
|
||
{
|
||
if (EntityAircraftGun == null || EntityAircraftGun is not EntityAntiAircraftGun aircraftGun || !_startPosX.HasValue || !_startPosY.HasValue)
|
||
{
|
||
return;
|
||
}
|
||
|
||
|
||
Pen pen = new(Color.Black);
|
||
Brush additionalBrush = new SolidBrush(aircraftGun.AdditionalColor);
|
||
|
||
base.DrawTransport(g);
|
||
|
||
|
||
if (aircraftGun.Tower)
|
||
{
|
||
g.FillRectangle(additionalBrush, _startPosX.Value + 35, _startPosY.Value + 50, 35, 15);
|
||
g.DrawRectangle(pen, _startPosX.Value + 35, _startPosY.Value + 50, 35, 15);
|
||
g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 50, _startPosX.Value + 90, _startPosY.Value + 20);
|
||
g.DrawLine(pen, _startPosX.Value + 60, _startPosY.Value + 50, _startPosX.Value + 95, _startPosY.Value + 27);
|
||
g.DrawLine(pen, _startPosX.Value + 45, _startPosY.Value + 50, _startPosX.Value + 60, _startPosY.Value + 50);
|
||
g.DrawLine(pen, _startPosX.Value + 90, _startPosY.Value + 20, _startPosX.Value + 95, _startPosY.Value + 27);
|
||
g.DrawLine(pen, _startPosX.Value + 90, _startPosY.Value + 20, _startPosX.Value + 100, _startPosY.Value + 20);
|
||
g.DrawLine(pen, _startPosX.Value + 100, _startPosY.Value + 20, _startPosX.Value + 95, _startPosY.Value + 27);
|
||
|
||
}
|
||
|
||
if (aircraftGun.Radar)
|
||
{
|
||
g.DrawLine(pen, _startPosX.Value + 20, _startPosY.Value + 65, _startPosX.Value + 20, _startPosY.Value + 40);
|
||
g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 40, 20, 20);
|
||
g.DrawRectangle(pen, _startPosX.Value + 10, _startPosY.Value + 40, 20, 20);
|
||
}
|
||
|
||
|
||
}
|
||
} |