54 lines
1.8 KiB
C#
54 lines
1.8 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
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)
|
|
{
|
|
ArmoredVehicle = new TankEnity(speed, weight, bodyColor, dopColor, machineGun, tower, gun);
|
|
}
|
|
|
|
public override void DrawTransport(Graphics g)
|
|
{
|
|
if (ArmoredVehicle is not TankEnity machine)
|
|
{
|
|
return;
|
|
}
|
|
|
|
base.DrawTransport(g);
|
|
|
|
Brush br = new SolidBrush(machine?.DopColor ?? Color.Black);
|
|
Pen p = new Pen(machine?.DopColor ?? Color.Black, 5);
|
|
|
|
if (machine.Tower)
|
|
{
|
|
|
|
g.FillRectangle(br, _startPosX + 60, _startPosY - 30, 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);
|
|
}
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// Получение текущей позиции объекта
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
|
|
{
|
|
return (_startPosX + 15, _startPosY - 45, _startPosX + 250, _startPosY + 60);
|
|
}
|
|
}
|
|
}
|