PIbd-22_Isaeva_A.I._Airbus_.../Airbus/Drawnings/DrawningPlane.cs
2023-11-18 10:00:43 +04:00

49 lines
1.6 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ProjectAirbus.Entities;
namespace ProjectAirbus.Drawnings
{
internal class DrawningPlane : DrawningAirbus
{
public DrawningPlane(int speed, double weight, Color bodyColor, Color additionalColor,bool isCompartment, bool isAdditionalEngine, int width, int height) :
base (speed, weight, bodyColor, width, height, 110, 60)
{
if (EntityAirbus != null)
{
EntityAirbus = new EntityPlane(speed, weight, bodyColor, additionalColor, isCompartment, isAdditionalEngine);
}
}
public override void DrawTransport(Graphics g)
{
if (EntityAirbus is not EntityPlane superAirbus)
{
return;
}
Pen pen = new(Color.Black);
Brush bodyBrush = new SolidBrush(EntityAirbus.BodyColor);
Brush additionalBrush = new SolidBrush(superAirbus.AdditionalColor);
// доп отсек
if (superAirbus.IsCompartment)
{
g.DrawEllipse(pen, _startPosX + 51, _startPosY + 10, 24, 10);
g.FillEllipse(bodyBrush, _startPosX + 51, _startPosY + 10, 24, 10);
}
base.DrawTransport(g);
// доп двигатель
if (superAirbus.IsAdditionalEngine)
{
g.DrawEllipse(pen, _startPosX, _startPosY + 20, 11, 5);
g.FillEllipse(additionalBrush, _startPosX, _startPosY + 20, 11, 5);
}
}
}
}