64 lines
2.4 KiB
C#
64 lines
2.4 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Linq;
|
||
using System.Text;
|
||
using System.Threading.Tasks;
|
||
using ProjectDumpTruck.Entities;
|
||
|
||
namespace ProjectDumpTruck.Drawnings;
|
||
|
||
/// <summary>
|
||
/// Класс, отвечающий за прорисовку и перемещение объекта-сущности
|
||
/// </summary>
|
||
public class DrawningDumpTruck : DrawningTruck
|
||
{
|
||
/// <summary>
|
||
/// Конструктор
|
||
/// </summary>
|
||
/// <param name="speed">Скорость</param>
|
||
/// <param name="weight">Вес</param>
|
||
/// <param name="bodyColor">Основной цвет</param>
|
||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||
/// <param name="awning">Признак наличия обвеса</param>
|
||
/// <param name="tent">Признак наличия антикрыла</param>
|
||
public DrawningDumpTruck(int speed, double weight, Color bodyColor, Color additionalColor, bool awning, bool tent) : base(135, 85)
|
||
{
|
||
EntityTruck = new EntityDumpTruck(speed, weight, bodyColor, additionalColor, awning, tent);
|
||
}
|
||
public override void DrawTransport(Graphics g)
|
||
{
|
||
if (EntityTruck == null || EntityTruck is not EntityDumpTruck dumpTruck || !_startPosX.HasValue || !_startPosY.HasValue)
|
||
{
|
||
return;
|
||
}
|
||
|
||
base.DrawTransport(g);
|
||
|
||
Pen pen = new(Color.Black);
|
||
Brush additionalBrush = new SolidBrush(dumpTruck.AdditionalColor);
|
||
|
||
//Отрисовка кузова
|
||
if (dumpTruck.Awning)
|
||
{
|
||
g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value, 90, 35);
|
||
}
|
||
|
||
//Отрисовка тента
|
||
if (dumpTruck.Awning & dumpTruck.Tent)
|
||
{
|
||
Brush tent = new SolidBrush(dumpTruck.AdditionalColor);
|
||
g.FillRectangle(tent, _startPosX.Value, _startPosY.Value, 95, 10);
|
||
g.FillRectangle(tent, _startPosX.Value, _startPosY.Value, 95, 3);
|
||
g.FillRectangle(tent, _startPosX.Value + 30, _startPosY.Value, 3, 40);
|
||
g.FillRectangle(tent, _startPosX.Value + 70, _startPosY.Value, 3, 40);
|
||
|
||
Pen t = new(Color.Black);
|
||
g.DrawRectangle(t, _startPosX.Value, _startPosY.Value, 95, 10);
|
||
g.DrawRectangle(t, _startPosX.Value + 30, _startPosY.Value, 3, 40);
|
||
g.DrawRectangle(t, _startPosX.Value + 70, _startPosY.Value, 3, 40);
|
||
}
|
||
}
|
||
}
|
||
|
||
|