PIbd-23-Kondratev-N.D.-Gaso.../GasolineTanker/ProjectGasolineTanker/Drawings/DrawingGasolineTanker.cs
2024-10-03 00:40:53 +03:00

52 lines
1.8 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using ProjectGasolineTanker.Entities;
namespace ProjectGasolineTanker.Drawings
{
public class DrawingGasolineTanker : DrawingTruck
{
public DrawingGasolineTanker(int speed, double weight, Color bodyColor, Color additionalColor, bool tank, bool wheel, int width, int height) : base(speed, weight, bodyColor, width, height, 130, 70)
{
if (EntityTruck != null)
{
EntityTruck = new EntityGasolineTanker(speed, weight, bodyColor, additionalColor, tank, wheel);
}
}
public override void DrawTransport(Graphics g)
{
if (EntityTruck is not EntityGasolineTanker GasolineTanker)
{
return;
}
Pen pen = new(Color.Black);
Pen additionalPen = new(GasolineTanker.Add_Color);
Brush additionalBrush = new SolidBrush(GasolineTanker.Add_Color);
base.DrawTransport(g);
if (GasolineTanker.Tank)
{
g.FillRectangle(additionalBrush, _startPosX + 45, _startPosY + 53, 35, 20);
g.DrawLine(pen, _startPosX + 45, _startPosY + 53, _startPosX + 80, _startPosY + 73);
g.DrawLine(pen, _startPosX + 80, _startPosY + 53, _startPosX + 45, _startPosY + 73);
}
if (GasolineTanker.Wheel)
{
Brush gr = new SolidBrush(Color.Gray);
g.FillEllipse(additionalBrush, _startPosX + 85, _startPosY + 55, 22, 22);
g.FillEllipse(gr, _startPosX + 87, _startPosY + 57, 18, 18);
g.DrawEllipse(pen, _startPosX + 85, _startPosY + 55, 22, 22);
}
}
}
}