54 lines
2.0 KiB
C#
54 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Net.NetworkInformation;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using DumpTruck.Entities;
|
|
|
|
|
|
namespace DumpTruck.DrawingObjects
|
|
{
|
|
public class DrawingDumpTruck : DrawingTruck
|
|
{
|
|
public DrawingDumpTruck(int speed, double weight, Color bodyColor, bool tent, bool dumpBox, Color tentColor, Color dumpBoxColor, int width, int height)
|
|
: base(speed, weight, bodyColor, width, height, 160, 90)
|
|
{
|
|
if (EntityTruck != null)
|
|
{
|
|
EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, tent, dumpBox, tentColor, dumpBoxColor);
|
|
}
|
|
}
|
|
public override void DrawTransport(Graphics g)
|
|
{
|
|
if (EntityTruck is not EntityDumpTruck dumpTruck)
|
|
{
|
|
return;
|
|
}
|
|
|
|
base.DrawTransport(g);
|
|
|
|
if (dumpTruck.DumpBox)
|
|
{
|
|
Brush brDumpBox = new SolidBrush(dumpTruck.DumpBoxColor);
|
|
Point point1 = new Point(_startPosX + 20, _startPosY);
|
|
Point point2 = new Point(_startPosX + 120, _startPosY);
|
|
Point point3 = new Point(_startPosX + 100, _startPosY + 39);
|
|
Point point4 = new Point(_startPosX, _startPosY + 39);
|
|
Point[] dumpBoxPoints = { point1, point2, point3, point4 };
|
|
g.FillPolygon(brDumpBox, dumpBoxPoints);
|
|
}
|
|
if (dumpTruck.DumpBox && dumpTruck.Tent)
|
|
{
|
|
Brush brTent = new SolidBrush(dumpTruck.TentColor);
|
|
Point point1 = new Point(_startPosX + 15, _startPosY);
|
|
Point point2 = new Point(_startPosX + 120, _startPosY);
|
|
Point point3 = new Point(_startPosX + 115, _startPosY + 10);
|
|
Point point4 = new Point(_startPosX + 10, _startPosY + 10);
|
|
Point[] tentPoints = { point1, point2, point3, point4 };
|
|
g.FillPolygon(brTent, tentPoints);
|
|
}
|
|
}
|
|
}
|
|
}
|