using System.Drawing.Drawing2D;
using ProjectCruiser.Entities;
namespace ProjectCruiser.Drawnings
{
public class DrawningMilitaryCruiser : DrawningCruiser
{
///
/// Конструктор
///
/// Скорость
/// Вес
/// Основной цвет
/// Дополнительный цвет
/// Признак наличия вертолетной площадки
/// Признак наличия шлюпок
/// Признак наличия пушки
public DrawningMilitaryCruiser(int speed, double weight, Color bodyColor, Color additionalColor, bool helicopterArea, bool boat, bool weapon)
: base(150, 50)
{
EntityCruiser = new EntityMilitaryCruiser(speed, weight, bodyColor, additionalColor, helicopterArea, boat, weapon);
}
public override void DrawTransport(Graphics g)
{
if (EntityCruiser == null || EntityCruiser is not EntityMilitaryCruiser entityMilitaryCruiser || !_startPosX.HasValue ||
!_startPosY.HasValue)
{
return;
}
Pen pen = new(entityMilitaryCruiser.BodyColor, 2);
Brush additionalBrush = new SolidBrush(Color.Black);
Brush weaponBrush = new SolidBrush(Color.Black);
Brush weaponBrush2 = new SolidBrush(entityMilitaryCruiser.AdditionalColor);
Brush helicopterAreaBrush = new HatchBrush(HatchStyle.ZigZag, entityMilitaryCruiser.AdditionalColor, Color.FromArgb(163, 163, 163));
Brush boatBrush = new SolidBrush(entityMilitaryCruiser.AdditionalColor);
base.DrawTransport(g);
if (entityMilitaryCruiser.HelicopterArea)
{
g.FillEllipse(helicopterAreaBrush, _startPosX.Value + 5, _startPosY.Value + 9, 25, 30);
g.DrawEllipse(pen, _startPosX.Value + 5, _startPosY.Value + 9, 25, 30);
}
if (entityMilitaryCruiser.Boat)
{
g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 2, 30, 7);
g.FillEllipse(boatBrush, _startPosX.Value + 34, _startPosY.Value + 2, 30, 7);
g.DrawEllipse(pen, _startPosX.Value + 34, _startPosY.Value + 39, 30, 7);
g.FillEllipse(boatBrush, _startPosX.Value + 34, _startPosY.Value + 39, 30, 7);
}
if (entityMilitaryCruiser.Weapon)
{
g.DrawEllipse(pen, _startPosX.Value + 97, _startPosY.Value + 36, 10, 10);
g.FillEllipse(weaponBrush2, _startPosX.Value + 97, _startPosY.Value + 36, 10, 10);
g.FillRectangle(weaponBrush, _startPosX.Value + 107, _startPosY.Value + 40, 15, 5);
}
}
}
}