28 lines
1.4 KiB
C#
28 lines
1.4 KiB
C#
namespace ElectricLocomotive;
|
|
|
|
public class DrawingElectricLocomotiv : DrawingLocomotiv
|
|
{
|
|
public DrawingElectricLocomotiv(int speed, double weight, int width, int height) : base(speed, weight, width,
|
|
height)
|
|
{
|
|
if (EntityLocomotiv != null)
|
|
{
|
|
EntityLocomotiv = new EntityElectricLocomotiv(speed, weight, Color.Crimson, Color.Blue);
|
|
}
|
|
}
|
|
|
|
public override void DrawLoco(Graphics g)
|
|
{
|
|
if (EntityLocomotiv == null) return;
|
|
base.DrawLoco(g);
|
|
if (EntityLocomotiv is not EntityElectricLocomotiv electricLocomotiv) return;
|
|
SolidBrush batteryBrush = new(electricLocomotiv.BatteryColor);
|
|
Pen rogaPen = new(electricLocomotiv.RogaColor);
|
|
//Roga
|
|
g.DrawLine(rogaPen, new Point(_startPosX + _vehicleWidth / 2, _startPosY + 30), new Point(_startPosX + _vehicleWidth / 2 + 10, _startPosY + 15));
|
|
g.DrawLine(rogaPen, new Point(_startPosX + _vehicleWidth / 2 + 10, _startPosY + 15), new Point(_startPosX + _vehicleWidth / 2, _startPosY));
|
|
//battery
|
|
Point[] batteryPoints = { new Point(_startPosX + _vehicleWidth - 10,_startPosY + _vehicleHeight - 25), new Point(_startPosX + _vehicleWidth, _startPosY + _vehicleHeight - 20), new Point(_startPosX + _vehicleWidth, _startPosY + _vehicleHeight - 55), new Point(_startPosX + _vehicleWidth - 10, _startPosY + _vehicleHeight - 50) };
|
|
g.FillPolygon(batteryBrush, batteryPoints);
|
|
}
|
|
} |