58 lines
2.7 KiB
C#
58 lines
2.7 KiB
C#
using SelfPropelledArtilleryUnit.Entities;
|
|
|
|
namespace SelfPropelledArtilleryUnit.Drawnings;
|
|
/// <summary>
|
|
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
|
/// </summary>
|
|
|
|
public class DrawningSelfPropelledArtilleryUnit : DrawningPropelledArtillery
|
|
{
|
|
/// <summary>
|
|
/// Конструктор
|
|
/// </summary>
|
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
|
/// <param name="turretCannon">Признак наличия башни</param>
|
|
/// <param name="launchBattery">Признак наличия орудия</param>
|
|
public DrawningSelfPropelledArtilleryUnit(int speed, double weight, Color bodyColor, Color additionalColor, bool turretCannon, bool launchBattery) : base(135, 105)
|
|
{
|
|
EntityPropelledArtillery = new EntitySelfPropelledArtilleryUnit(speed, weight, bodyColor, additionalColor, turretCannon, launchBattery);
|
|
//дописать
|
|
}
|
|
|
|
public override void DrawTransport(Graphics g)
|
|
{
|
|
if (EntityPropelledArtillery == null || EntityPropelledArtillery is not EntitySelfPropelledArtilleryUnit selfpropelledartilleryunit || !_startPosX.HasValue || !_startPosY.HasValue)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Pen pen = new(Color.Black);
|
|
Brush additionalBrush = new SolidBrush(selfpropelledartilleryunit.AdditionalColor);
|
|
|
|
if (selfpropelledartilleryunit.TurretCannon)
|
|
{
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 26, _startPosY.Value + 35, 50, 30);
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 25, _startPosY.Value + 36, 20, 29);
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 60, _startPosY.Value + 45, 60, 5);
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 113, _startPosY.Value + 42, 20, 10);
|
|
}
|
|
|
|
if (selfpropelledartilleryunit.LaunchBattery)
|
|
{
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 0, _startPosY.Value + 45, 20, 20);
|
|
g.FillPolygon(additionalBrush, new Point[]
|
|
{
|
|
new Point(_startPosX.Value + 0, _startPosY.Value + 15), new Point(_startPosX.Value + 0, _startPosY.Value + 65),
|
|
new Point(_startPosX.Value + 20, _startPosY.Value + 65), new Point(_startPosX.Value + 20, _startPosY.Value + 45),
|
|
new Point(_startPosX.Value + 0, _startPosY.Value + 15)
|
|
});
|
|
g.FillEllipse(additionalBrush, _startPosX.Value + 0, _startPosY.Value + 5, 10, 30);
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 15, 20, 5);
|
|
g.FillRectangle(additionalBrush, _startPosX.Value + 10, _startPosY.Value + 25, 15, 5);
|
|
}
|
|
|
|
base.DrawTransport(g);
|
|
|
|
|
|
}
|
|
} |