58 lines
1.9 KiB
C#
Raw Normal View History

2022-09-11 18:00:27 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ArmoredVehicle
{
internal class DrawingTank : DrawingArmoredVehicle
{
2022-10-30 10:53:52 +04:00
public DrawingTank(int speed, float weight, Color bodyColor, Color dopColor, bool machineGun, bool tower)
2022-09-21 14:05:06 +04:00
: base(speed, weight, bodyColor, 200, 60)
2022-09-11 18:00:27 +04:00
{
2022-10-30 10:53:52 +04:00
ArmoredVehicle = new TankEnity(speed, weight, bodyColor, dopColor, machineGun, tower);
}
public DrawingTank Copy(int? speed = null, float? weight = null, Color? bodyColor = null,
Color? dopColor = null, bool? machineGun = null, bool? tower = null)
{
var e = (TankEnity)ArmoredVehicle;
return new DrawingTank(speed ?? e.Speed, weight ?? e.Weight, bodyColor ?? e.BodyColor, dopColor ?? e.DopColor,
machineGun ?? e.MachineGun, tower ?? e.Tower);
2022-09-11 18:00:27 +04:00
}
public override void DrawTransport(Graphics g)
{
if (ArmoredVehicle is not TankEnity machine)
{
return;
}
2022-09-12 19:23:19 +04:00
2022-09-11 18:00:27 +04:00
Brush br = new SolidBrush(machine?.DopColor ?? Color.Black);
Pen p = new Pen(machine?.DopColor ?? Color.Black, 5);
2022-09-21 14:05:06 +04:00
_startPosY += 40;
base.DrawTransport(g);
_startPosY -= 40;
2022-09-11 18:00:27 +04:00
if (machine.Tower)
{
2022-09-21 14:05:06 +04:00
g.FillRectangle(br, _startPosX + 60, _startPosY + 10, 80, 30);
g.DrawLine(p, _startPosX + 90, _startPosY +20, _startPosX + 250, _startPosY + 20);
2022-09-11 18:00:27 +04:00
if (machine.MachineGun)
{
p = new Pen(machine?.DopColor ?? Color.Black, 3);
2022-09-21 14:05:06 +04:00
g.DrawLine(p, _startPosX + 90, _startPosY, _startPosX + 90, _startPosY + 10);
g.DrawLine(p, _startPosX + 85, _startPosY + 5, _startPosX + 120, _startPosY + 5);
2022-09-11 18:00:27 +04:00
}
}
2022-09-21 14:05:06 +04:00
2022-09-12 19:23:19 +04:00
}
2022-09-21 14:05:06 +04:00
2022-09-12 19:23:19 +04:00
}
2022-09-11 18:00:27 +04:00
}