DozorovaA.A_SecondLabWork #2

Merged
eegov merged 8 commits from SecondLabWork into FirstLabWork 2022-09-30 11:05:38 +04:00
7 changed files with 36 additions and 36 deletions
Showing only changes of commit 26955fb8c8 - Show all commits

View File

@ -16,6 +16,8 @@ namespace ArmoredVehicle
BodyColor = bodyColor;
}
/// <summary>
/// Скорость
/// </summary>

View File

@ -46,12 +46,14 @@ namespace ArmoredVehicle
{
ArmoredVehicle = new ArmoredVehicleEntity(speed, weight, bodyColor);
}
protected DrawingArmoredVehicle(int speed, float weight, Color bodyColor, int ArmoredVehicleWidth, int ArmoredVehicleHeight):
this(speed, weight, bodyColor)
public DrawingArmoredVehicle(int speed, float weight, Color bodyColor, int ArmoredVehicleWidth, int ArmoredVehicleHeight)
:this(speed, weight, bodyColor)
{
_ArmoredVehicleHeight = ArmoredVehicleHeight;
_ArmoredVehicleWidth = ArmoredVehicleWidth;
_ArmoredVehicleHeight = ArmoredVehicleHeight + 50;
_ArmoredVehicleWidth = ArmoredVehicleWidth + 150;
}
/// <summary>
/// Установка позиции

View File

@ -9,10 +9,11 @@ namespace ArmoredVehicle
internal class DrawingTank : DrawingArmoredVehicle
{
public DrawingTank(int speed, float weight, Color bodyColor, Color dopColor, bool machineGun, bool tower, bool gun)
: base(speed, weight, bodyColor)
: base(speed, weight, bodyColor, 200, 60)
{
ArmoredVehicle = new TankEnity(speed, weight, bodyColor, dopColor, machineGun, tower, gun);
}
public override void DrawTransport(Graphics g)
{
@ -21,33 +22,29 @@ namespace ArmoredVehicle
return;
}
base.DrawTransport(g);
Brush br = new SolidBrush(machine?.DopColor ?? Color.Black);
Pen p = new Pen(machine?.DopColor ?? Color.Black, 5);
_startPosY += 40;
base.DrawTransport(g);
_startPosY -= 40;
if (machine.Tower)
{
g.FillRectangle(br, _startPosX + 60, _startPosY - 30, 80, 30);
g.DrawLine(p, _startPosX + 90, _startPosY - 20, _startPosX + 250, _startPosY - 20);
g.FillRectangle(br, _startPosX + 60, _startPosY + 10, 80, 30);
g.DrawLine(p, _startPosX + 90, _startPosY +20, _startPosX + 250, _startPosY + 20);
if (machine.MachineGun)
{
p = new Pen(machine?.DopColor ?? Color.Black, 3);
g.DrawLine(p, _startPosX + 90, _startPosY - 45, _startPosX + 90, _startPosY - 30);
g.DrawLine(p, _startPosX + 85, _startPosY - 35, _startPosX + 120, _startPosY - 35);
g.DrawLine(p, _startPosX + 90, _startPosY, _startPosX + 90, _startPosY + 10);
g.DrawLine(p, _startPosX + 85, _startPosY + 5, _startPosX + 120, _startPosY + 5);
}
}
}
/// <summary>
/// Получение текущей позиции объекта
/// </summary>
/// <returns></returns>
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX + 15, _startPosY - 45, _startPosX + 250, _startPosY + 60);
}
}
}

View File

@ -30,5 +30,6 @@
{
_machine.DrawTransport(g);
}
}
}

View File

@ -8,6 +8,7 @@ namespace ArmoredVehicle
{
internal class HorizontalMap : AbstractMap
{
/// <summary>
/// Цвет участка закрытого
/// </summary>

View File

@ -33,5 +33,6 @@
/// </summary>
/// <returns></returns>
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
}
}

View File

@ -8,6 +8,16 @@ namespace ArmoredVehicle
{
internal class TankEnity : ArmoredVehicleEntity
{
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="dopColor">Дополнительный цвет</param>
/// <param name="MachineGun">Признак наличия пулемета</param>
/// <param name="Tower">Признак наличия башни</param>
/// <param name="Gun">Признак наличия орудия</param>
public TankEnity(int speed, float weight, Color bodyColor, Color dopColor, bool machineGun, bool tower, bool gun) : base(speed, weight, bodyColor)
{
@ -33,20 +43,6 @@ namespace ArmoredVehicle
/// Признак наличия орудия
/// </summary>
public bool Gun { get; private set; }
/// <summary>
/// Признак наличия полосы
/// </summary>
public bool Line { get; private set; }
/// <summary>
/// Инициализация свойств
/// </summary>
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес автомобиля</param>
/// <param name="bodyColor">Цвет кузова</param>
/// <param name="dopColor">Дополнительный цвет</param>
/// <param name="MachineGun">Признак наличия пулемета</param>
/// <param name="Tower">Признак наличия башни</param>
/// <param name="Gun">Признак наличия орудия</param>
}