76 lines
3.5 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
namespace Trolleybus
{
internal class DrawningSmallTrolleybus : DrawingTrolleybus
{
public DrawningSmallTrolleybus(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool horns, bool battary) :
base(speed, weight, bodyColor, 110, 60)
{
Trolleybus = new EntitySmallTrolleybus(speed, weight, bodyColor, dopColor,bodyKit, horns, battary);
}
public override void DrawTransport(Graphics g)
{
if (Trolleybus is not EntitySmallTrolleybus smallTrolleybus)
{
return;
}
Pen pen = new Pen(Color.Black);
Brush dopBrush = new SolidBrush(smallTrolleybus.DopColor);
Brush brBlue = new SolidBrush(Color.LightBlue);
Brush dBlue = new SolidBrush(Color.DarkBlue);
Brush bWhite = new SolidBrush(Color.White);
Pen WinBlue = new Pen(Color.Blue);
Brush br = new SolidBrush(smallTrolleybus?.DopColor ?? Color.Black);
base.DrawTransport(g);
if (smallTrolleybus.BodyKit)
{
g.FillRectangle(br, _startPosX, _startPosY, 200, 50);
g.DrawRectangle(pen, _startPosX, _startPosY, 200, 50);
g.DrawRectangle(pen, _startPosX + 100, _startPosY + 10, 20, 40);
g.FillEllipse(brBlue, _startPosX, _startPosY + 5, 20, 25);
g.DrawEllipse(WinBlue, _startPosX, _startPosY + 5, 20, 25);
g.FillEllipse(brBlue, _startPosX + 25, _startPosY + 5, 20, 25);
g.DrawEllipse(WinBlue, _startPosX + 25, _startPosY + 5, 20, 25);
g.FillEllipse(brBlue, _startPosX + 50, _startPosY + 5, 20, 25);
g.DrawEllipse(WinBlue, _startPosX + 50, _startPosY + 5, 20, 25);
g.FillEllipse(brBlue, _startPosX + 75, _startPosY + 5, 20, 25);
g.DrawEllipse(WinBlue, _startPosX + 75, _startPosY + 5, 20, 25);
g.FillEllipse(brBlue, _startPosX + 120, _startPosY + 5, 20, 25);
g.DrawEllipse(WinBlue, _startPosX + 120, _startPosY + 5, 20, 25);
g.FillEllipse(brBlue, _startPosX + 145, _startPosY + 5, 20, 25);
g.DrawEllipse(WinBlue, _startPosX + 145, _startPosY + 5, 20, 25);
g.FillEllipse(brBlue, _startPosX + 170, _startPosY + 5, 20, 25);
g.DrawEllipse(WinBlue, _startPosX + 170, _startPosY + 5, 20, 25);
g.FillEllipse(bWhite, _startPosX, _startPosY + 40, 30, 30);
g.DrawEllipse(pen, _startPosX, _startPosY + 40, 30, 30);
g.FillEllipse(bWhite, _startPosX + 170, _startPosY + 40, 30, 30);
g.DrawEllipse(pen, _startPosX + 170, _startPosY + 40, 30, 30);
}
if (smallTrolleybus.Horns)
{
g.DrawLine(pen, _startPosX + 100, _startPosY - 10, _startPosX + 150, _startPosY - 20);
g.DrawLine(pen, _startPosX + 150, _startPosY - 20, _startPosX, _startPosY - 30);
g.FillRectangle(dopBrush, _startPosX + 50, _startPosY - 10, 100, 10);
g.DrawRectangle(pen, _startPosX + 50, _startPosY - 10, 100, 10);
}
if (smallTrolleybus.Battary)
{
g.FillRectangle(dopBrush, _startPosX + 100, _startPosY, 10, 10);
g.DrawRectangle(pen, _startPosX + 100, _startPosY, 10, 10);
}
}
}
}