65 lines
2.2 KiB
C#
65 lines
2.2 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 DrawningEntityFighter(EntityFighter fighter) : base(91, 65)
|
||
{
|
||
EntityTrackedVehicle = new EntityFighter(fighter.Speed, fighter.Weight, fighter.BodyColor, fighter.AdditionalColor, fighter.Kovsh, fighter.Otval);
|
||
|
||
}
|
||
|
||
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 - 17, _startPosY.Value + 12, 8, 15);
|
||
g.FillRectangle(CraneBrush, _startPosX.Value - 17, _startPosY.Value + 12, 8, 15);
|
||
g.DrawRectangle(pen, _startPosX.Value - 8, _startPosY.Value + 17, 5, 1);
|
||
|
||
}
|
||
|
||
///противовес
|
||
if (fighter.Otval)
|
||
{
|
||
g.DrawRectangle(pen, _startPosX.Value + 63, _startPosY.Value + 17, 17, 1);
|
||
g.DrawRectangle(pen, _startPosX.Value + 80, _startPosY.Value + 17, 1, 16);
|
||
|
||
|
||
}
|
||
}
|
||
|
||
}
|