59 lines
2.0 KiB
C#
59 lines
2.0 KiB
C#
using lab1.Entities;
|
||
namespace lab1.Drawnings;
|
||
|
||
/// <summary>
|
||
/// Класс, отвечающий за прорисовку и перемещение базового объекта-сущности
|
||
/// </summary>
|
||
public class DrawningEntityFighter : DrawningTrackedVehicle
|
||
{
|
||
/// <summary>
|
||
/// Конструктор
|
||
/// </summary>
|
||
/// <param name="speed">Скорость</param>
|
||
/// <param name="weight">>Вес истребителя</param>
|
||
/// <param name="bodyColor">Основной цвет</param>
|
||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||
/// <param name="rockets">Признак наличия ракет</param>
|
||
/// <param name="extraWings">Признак наличия доп. крыльев</param>
|
||
public DrawningEntityFighter(int speed, double weight, Color bodyColor, Color additionalColor, bool rockets, bool extraWings) : base (91, 65)
|
||
{
|
||
EntityTrackedVehicle = new EntityFighter(speed, weight, bodyColor, additionalColor, rockets, extraWings);
|
||
|
||
}
|
||
|
||
public override void DrawTransport(Graphics g)
|
||
{
|
||
if (EntityTrackedVehicle == null || EntityTrackedVehicle is not EntityFighter fighter || !_startPosX.HasValue || !_startPosY.HasValue)
|
||
{
|
||
return;
|
||
}
|
||
Pen pen = new(Color.Black);
|
||
Brush CraneBrush = new SolidBrush(fighter.AdditionalColor);
|
||
|
||
|
||
|
||
base.DrawTransport(g);
|
||
|
||
if (fighter.Kovsh)
|
||
{
|
||
|
||
//ковш
|
||
g.DrawRectangle(pen, _startPosX.Value - 15, _startPosY.Value + 15, 8, 15);
|
||
g.FillRectangle(CraneBrush, _startPosX.Value - 15, _startPosY.Value + 15, 8, 15);
|
||
g.DrawRectangle(pen, _startPosX.Value - 15, _startPosY.Value + , 4, 1);
|
||
|
||
}
|
||
|
||
//противовес
|
||
if (fighter.Otval)
|
||
{
|
||
g.DrawRectangle(pen, _startPosX.Value + 73, _startPosY.Value + 37, 17, 1);
|
||
g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value + 37, 1, 17);
|
||
|
||
|
||
}
|
||
|
||
}
|
||
|
||
}
|