2022-10-13 15:15:54 +04:00

55 lines
1.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjectMachine
{
internal class DrawningTank : DrawningMachine
{
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="dopColor">Дополнительный цвет</param>
/// <param name="turret">Признак наличия башни с орудием</param>
/// <param name="gun">Признак наличия зенитного пулемета</param>
public DrawningTank(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool turret, bool gun) :
base(speed, weight, bodyColor, 90, 50)
{
Machine = new EntityTank(speed, weight, bodyColor, dopColor, bodyKit, turret, gun);
}
public override void DrawTransport(Graphics g)
{
if (Machine is not EntityTank tank)
{
return;
}
Pen pen = new(Color.Black);
Brush dopBrush = new SolidBrush(tank.DopColor);
if (tank.Turret)
{
g.FillRectangle(dopBrush, _startPosX + 45, _startPosY, 20, 10);
g.DrawLine(pen, _startPosX + 65, _startPosY + 2, _startPosX + 85, _startPosY + 2);
}
if (tank.Gun)
{
g.FillRectangle(dopBrush, _startPosX + 23, _startPosY + 4, 3, 11);
g.DrawLine(pen, _startPosX + 23, _startPosY + 8, _startPosX + 5, _startPosY + 8);
}
_startPosX += 10;
_startPosY += 5;
base.DrawTransport(g);
_startPosX -= 10;
_startPosY -= 5;
}
}
}