63 lines
2.1 KiB
C#
63 lines
2.1 KiB
C#
using ProjectTank.Entities;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing.Drawing2D;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace ProjectTank.DrawningObjects
|
|
{
|
|
public class DrawningTank : DrawningTankBase
|
|
{
|
|
public DrawningTank(int speed, int weight, Color bodyColor, Color additionalColor, bool isTankTower, bool isAntiAirforceGun, int width, int height) : base(speed, weight, bodyColor, width, height)
|
|
{
|
|
if (EntityTankBase == null) return;
|
|
|
|
EntityTankBase = new EntityTank(speed, weight, bodyColor, additionalColor, isTankTower, isAntiAirforceGun);
|
|
}
|
|
|
|
public override void DrawTransport(Graphics g)
|
|
{
|
|
if (EntityTankBase is not EntityTank tank) return;
|
|
|
|
Pen pen = new(tank.AdditionalColor);
|
|
|
|
if (tank.TankTower)
|
|
{
|
|
// дуло
|
|
g.DrawRectangle(pen, startPosX + 15, startPosY + 37, 30, 7);
|
|
}
|
|
|
|
base.DrawTransport(g);
|
|
|
|
if (tank.AntiAirforceGun)
|
|
{
|
|
// зенитное орудие
|
|
g.DrawRectangle(pen, startPosX + 65, startPosY + 18, 8, 12);
|
|
g.DrawRectangle(pen, startPosX + 65 + 8, startPosY + 16, 8, 14);
|
|
|
|
Point[] leftRectanglePoints =
|
|
{
|
|
new Point(startPosX + 52, startPosY + 5),
|
|
new Point(startPosX + 67, startPosY + 18),
|
|
new Point(startPosX + 67 + 5, startPosY + 18),
|
|
new Point(startPosX + 57, startPosY + 5),
|
|
};
|
|
|
|
g.DrawPolygon(pen, leftRectanglePoints);
|
|
|
|
Point[] rightRectanglePoints =
|
|
{
|
|
new Point(startPosX + 59, startPosY),
|
|
new Point(startPosX + 74, startPosY + 16),
|
|
new Point(startPosX + 74 + 5, startPosY + 16),
|
|
new Point(startPosX + 66, startPosY),
|
|
};
|
|
|
|
g.DrawPolygon(pen, rightRectanglePoints);
|
|
}
|
|
}
|
|
}
|
|
} |