30 lines
1.6 KiB
C#
30 lines
1.6 KiB
C#
using System.Drawing.Drawing2D;
|
|
|
|
namespace ElectricLocomotive;
|
|
|
|
public class DrawingElectricLocomotiv : DrawingLocomotiv
|
|
{
|
|
public DrawingElectricLocomotiv(int speed, double weight, int width, int height, Color mainColor, Color dopColor, Color batteryColor, Color rogaColor) : base(speed, weight, width,
|
|
height, mainColor, dopColor)
|
|
{
|
|
if (EntityLocomotiv != null)
|
|
{
|
|
EntityLocomotiv = new EntityElectricLocomotiv(speed, weight, batteryColor, rogaColor, mainColor, dopColor);
|
|
}
|
|
}
|
|
|
|
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);
|
|
}
|
|
} |