76 lines
3.2 KiB
C#
76 lines
3.2 KiB
C#
using System.Drawing.Drawing2D;
|
||
using ProjectCruiser.Entities;
|
||
|
||
namespace ProjectCruiser.Drawnings
|
||
{
|
||
public class DrawningMilitaryCruiser : DrawningCruiser
|
||
{
|
||
/// <summary>
|
||
/// Конструктор
|
||
/// </summary>
|
||
/// <param name="speed">Скорость</param>
|
||
/// <param name="weight">Вес</param>
|
||
/// <param name="bodyColor">Основной цвет</param>
|
||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||
/// <param name="helicopterArea">Признак наличия вертолетной площадки</param>
|
||
/// <param name="boat">Признак наличия шлюпок</param>
|
||
/// <param name="weapon">Признак наличия пушки</param>
|
||
|
||
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 DrawningMilitaryCruiser(EntityCruiser entityCruiser)
|
||
{
|
||
if (entityCruiser != null)
|
||
{
|
||
EntityCruiser = entityCruiser;
|
||
}
|
||
}
|
||
|
||
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);
|
||
}
|
||
|
||
}
|
||
}
|
||
}
|