PIbd-21_KozyrevSS_GasolineT.../Lab/DrawGasolineTanker.cs

47 lines
1.6 KiB
C#
Raw Normal View History

2023-09-26 19:15:17 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2023-09-26 19:32:10 +04:00
using Lab.Entities;
2023-09-26 19:15:17 +04:00
2023-09-26 19:32:10 +04:00
namespace Lab.DrawningObjects
2023-09-26 19:15:17 +04:00
{
2023-09-26 19:32:10 +04:00
public class DrawGasolineTanker : DrawTanker
2023-09-26 19:15:17 +04:00
{
2023-09-26 19:32:10 +04:00
public DrawGasolineTanker(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool wing, bool sportLine, int width, int height) : base(speed, weight, bodyColor, width, height)
2023-09-26 19:15:17 +04:00
{
2023-09-26 19:32:10 +04:00
if (GasolineTanker != null)
2023-09-26 19:15:17 +04:00
{
2023-09-26 19:32:10 +04:00
GasolineTanker = new AddBaseCar(speed, weight, bodyColor, additionalColor, bodyKit, wing, sportLine);
2023-09-26 19:15:17 +04:00
}
}
2023-09-26 19:32:10 +04:00
public override void DrawTransport(Graphics g)
2023-09-26 19:15:17 +04:00
{
2023-09-26 19:32:10 +04:00
if (GasolineTanker is not AddBaseCar Gasoline)
2023-09-26 19:15:17 +04:00
return;
2023-09-26 19:32:10 +04:00
base.DrawTransport(g);
if (Gasoline.BodyKit)
2023-09-26 19:15:17 +04:00
{
2023-09-26 19:32:10 +04:00
Brush bodyBrush = new SolidBrush(Gasoline.AdditionalColor);
2023-09-26 19:15:17 +04:00
g.FillEllipse(bodyBrush, 10 + _startPosX, 10 + _startPosY, 70, 30);
}
2023-09-26 19:32:10 +04:00
if (Gasoline.SportLine)
2023-09-26 19:15:17 +04:00
{
2023-09-26 19:32:10 +04:00
Brush lineBrush = new SolidBrush(Gasoline.AdditionalColor);
2023-09-26 19:15:17 +04:00
g.FillRectangle(lineBrush, 15 + _startPosX, 45 + _startPosY, 20, 5);
g.FillRectangle(lineBrush, 40 + _startPosX, 45 + _startPosY, 20, 5);
g.FillRectangle(lineBrush, 65 + _startPosX, 45 + _startPosY, 20, 5);
}
2023-09-26 19:32:10 +04:00
if (Gasoline.Wing)
2023-09-26 19:15:17 +04:00
{
2023-09-26 19:32:10 +04:00
Brush lightBrush = new SolidBrush(Gasoline.AdditionalColor);
2023-09-26 19:15:17 +04:00
g.FillRectangle(lightBrush, 87 + _startPosX, 5 + _startPosY, 5, 5);
}
}
}
}