diff --git a/ProjectDumpTruck/ProjectDumpTruck/Drawnings/DrawningDumpTruck.cs b/ProjectDumpTruck/ProjectDumpTruck/Drawnings/DrawningDumpTruck.cs index 25232da..c3f34ec 100644 --- a/ProjectDumpTruck/ProjectDumpTruck/Drawnings/DrawningDumpTruck.cs +++ b/ProjectDumpTruck/ProjectDumpTruck/Drawnings/DrawningDumpTruck.cs @@ -27,83 +27,26 @@ public class DrawningDumpTruck : DrawningTruck } public override void DrawTransport(Graphics g) { - if (EntityTruck == null || !_startPosX.HasValue || !_startPosY.HasValue) + if (EntityTruck == null || EntityTruck is not EntityDumpTruck dumpTruck || !_startPosX.HasValue || !_startPosY.HasValue) { return; } base.DrawTransport(g); - } - - //public void DrawTransport(Graphics g) - { - if (EntityDumpTruck == null || !_startPosX.HasValue || !_startPosY.HasValue) - { - return; - } Pen pen = new(Color.Black); - Brush additionalBrush = new SolidBrush(EntityDumpTruck.AdditionalColor); - - //Кабина и основа - Brush body = new SolidBrush(EntityDumpTruck.BodyColor); - g.FillRectangle(body, _startPosX.Value + 100, _startPosY.Value, 30, 40); - g.DrawRectangle(pen, _startPosX.Value + 100, _startPosY.Value, 30, 40); - - g.FillRectangle(body, _startPosX.Value, _startPosY.Value + 40, 130, 20); - g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 40, 130, 20); - - //Фары - Brush light = new SolidBrush(Color.Yellow); - g.FillRectangle(light, _startPosX.Value + 130, _startPosY.Value + 40, 4, 5); - g.FillRectangle(light, _startPosX.Value - 5, _startPosY.Value + 40, 4, 5); - - Brush light1 = new SolidBrush(Color.DarkOrange); - g.FillRectangle(light1, _startPosX.Value + 125, _startPosY.Value + 40, 5, 5); - g.FillRectangle(light1, _startPosX.Value, _startPosY.Value + 40, 5, 5); - - //Стекло - Brush glass = new SolidBrush(Color.LightBlue); - g.FillRectangle(glass, _startPosX.Value + 110, _startPosY.Value + 5, 20, 25); - - //Отрисовка колёс - Brush wheels = new SolidBrush(Color.Black); - g.FillEllipse(wheels, _startPosX.Value, _startPosY.Value + 60, 30, 30); - g.FillEllipse(wheels, _startPosX.Value + 30, _startPosY.Value + 60, 30, 30); - g.FillEllipse(wheels, _startPosX.Value + 100, _startPosY.Value + 60, 30, 30); - - Brush kolpac = new SolidBrush(Color.Gray); - g.FillEllipse(kolpac, _startPosX.Value + 6, _startPosY.Value + 66, 17, 17); - g.FillEllipse(kolpac, _startPosX.Value + 36, _startPosY.Value + 66, 17, 17); - g.FillEllipse(kolpac, _startPosX.Value + 106, _startPosY.Value + 66, 17, 17); - - //Отрисовка границ - - - g.DrawRectangle(pen, _startPosX.Value, _startPosY.Value + 40, 130, 20); - g.DrawEllipse(pen, _startPosX.Value, _startPosY.Value + 60, 30, 30); - g.DrawEllipse(pen, _startPosX.Value + 30, _startPosY.Value + 60, 30, 30); - g.DrawEllipse(pen, _startPosX.Value + 100, _startPosY.Value + 60, 30, 30); - - Pen glass_ = new(Color.DarkGray); - g.DrawRectangle(glass_, _startPosX.Value + 110, _startPosY.Value + 5, 20, 25); - - Pen light_ = new(Color.LightBlue); - g.DrawRectangle(light_, _startPosX.Value + 130, _startPosY.Value + 40, 4, 5); - g.DrawRectangle(light_, _startPosX.Value + 125, _startPosY.Value + 40, 5, 5); - g.DrawRectangle(light_, _startPosX.Value - 5, _startPosY.Value + 40, 4, 5); - g.DrawRectangle(light_, _startPosX.Value, _startPosY.Value + 40, 5, 5); + Brush additionalBrush = new SolidBrush(dumpTruck.AdditionalColor); //Отрисовка кузова - if (EntityDumpTruck.Awning) + if (dumpTruck.Awning) { g.FillRectangle(additionalBrush, _startPosX.Value, _startPosY.Value, 90, 35); } //Отрисовка тента - if (EntityDumpTruck.Awning & EntityDumpTruck.Tent) + if (dumpTruck.Awning & dumpTruck.Tent) { - Brush tent = new SolidBrush(EntityDumpTruck.AdditionalColor); + 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); @@ -114,7 +57,6 @@ public class DrawningDumpTruck : DrawningTruck g.DrawRectangle(t, _startPosX.Value + 30, _startPosY.Value, 3, 40); g.DrawRectangle(t, _startPosX.Value + 70, _startPosY.Value, 3, 40); } - } } diff --git a/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityDumpTruck.cs b/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityDumpTruck.cs index 76cb60e..322c7b8 100644 --- a/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityDumpTruck.cs +++ b/ProjectDumpTruck/ProjectDumpTruck/Entities/EntityDumpTruck.cs @@ -25,7 +25,7 @@ public class EntityDumpTruck : EntityTruck /// <param name="additionalColor">Дополнительный цвет</param> /// <param name="awning">Признак наличия обвеса</param> /// <param name="tent">Признак наличия антикрыла</param> - public void Init(int speed, double weight, Color bodyColor, Color + public (int speed, double weight, Color bodyColor, Color additionalColor, bool awning, bool tent) { AdditionalColor = additionalColor;