lab2 is done with amendment

This commit is contained in:
vladimir_zinovev 2023-10-06 11:52:16 +04:00
parent de4231767b
commit 7e28d26868
4 changed files with 4 additions and 11 deletions

View File

@ -130,7 +130,6 @@ namespace ProjectTank.DrawningObjects
Brush blackColorBrush = new SolidBrush(Color.Black); Brush blackColorBrush = new SolidBrush(Color.Black);
Brush bodyBrush = new SolidBrush(EntityArmoredTransport.BodyColor); Brush bodyBrush = new SolidBrush(EntityArmoredTransport.BodyColor);
// Границы автомобиля // Границы автомобиля
// гусеницы // гусеницы
g.DrawEllipse(pen, _startPosX + 14, _startPosY + 44, 151, 31); g.DrawEllipse(pen, _startPosX + 14, _startPosY + 44, 151, 31);
@ -145,11 +144,10 @@ namespace ProjectTank.DrawningObjects
// Кузов // Кузов
g.DrawRectangle(pen, _startPosX + 19, _startPosY + 34, 141, 21); g.DrawRectangle(pen, _startPosX + 19, _startPosY + 34, 141, 21);
g.FillRectangle(bodyBrush, _startPosX + 20, _startPosY + 35, 140, 20); g.FillRectangle(bodyBrush, _startPosX + 20, _startPosY + 35, 140, 20);
// Башня // Башня
g.FillRectangle(blackColorBrush, _startPosX + 75, _startPosY + 10, 25, 5); g.FillRectangle(blackColorBrush, _startPosX + 75, _startPosY + 10, 25, 5);
g.DrawRectangle(pen, _startPosX + 64, _startPosY + 14, 66, 21); g.DrawRectangle(pen, _startPosX + 64, _startPosY + 14, 66, 21);
g.FillRectangle(bodyBrush, _startPosX + 65, _startPosY + 15, 65, 20); //*** -> bodyBrush <- additionalBrush g.FillRectangle(bodyBrush, _startPosX + 65, _startPosY + 15, 65, 20);
//Точки для отрисовки передней и задней части //Точки для отрисовки передней и задней части
Point pointFirstBackSide = new Point(_startPosX + 18, _startPosY + 35); Point pointFirstBackSide = new Point(_startPosX + 18, _startPosY + 35);
@ -158,7 +156,6 @@ namespace ProjectTank.DrawningObjects
Point pointFirstFrontSide = new Point(_startPosX + 162, _startPosY + 35); Point pointFirstFrontSide = new Point(_startPosX + 162, _startPosY + 35);
Point pointSecondFrontSide = new Point(_startPosX + 185, _startPosY + 55); Point pointSecondFrontSide = new Point(_startPosX + 185, _startPosY + 55);
Point pointThirdFrontSide = new Point(_startPosX + 162, _startPosY + 55); Point pointThirdFrontSide = new Point(_startPosX + 162, _startPosY + 55);
// Задняя часть // Задняя часть
Point[] backSide = { pointFirstBackSide, pointSecondBackSide, pointThirdBackSide }; Point[] backSide = { pointFirstBackSide, pointSecondBackSide, pointThirdBackSide };
g.DrawPolygon(pen, backSide); g.DrawPolygon(pen, backSide);

View File

@ -9,7 +9,7 @@ namespace ProjectTank.MovementStrategy
{ {
/// <summary> /// <summary>
/// Реализация интерфейса IDrawningObject для работы с объектом DrawningCar(паттерн Adapter) /// Реализация интерфейса IDrawningObject для работы с объектом DrawningCar(паттерн Adapter)
/// </summary> /// </summary>
public class DrawningObjectArmoredTransport : IMoveableObject public class DrawningObjectArmoredTransport : IMoveableObject
{ {
private readonly DrawningArmoredTransport? _drawningArmoredTransport = null; private readonly DrawningArmoredTransport? _drawningArmoredTransport = null;

View File

@ -26,13 +26,12 @@ namespace ProjectTank.DrawningObjects
/// <param name="width">Ширина картинки</param> /// <param name="width">Ширина картинки</param>
/// <param name="height">Высота картинки</param> /// <param name="height">Высота картинки</param>
public DrawningTank(int speed, double weight, Color bodyColor, Color public DrawningTank(int speed, double weight, Color bodyColor, Color
additionalColor, bool gun, bool machineGun, int width, int height) : additionalColor, bool gun, bool machineGun, int width, int height) : base(speed,weight, bodyColor, width, height, 200, 80)
base(speed, weight, bodyColor, width, height, 200, 80)
{ {
if (EntityArmoredTransport != null) if (EntityArmoredTransport != null)
{ {
EntityArmoredTransport = new EntityTank(speed, weight, bodyColor, EntityArmoredTransport = new EntityTank(speed, weight, bodyColor,
additionalColor, gun, machineGun); additionalColor, gun, machineGun);
} }
} }
public override void DrawTransport(Graphics g) public override void DrawTransport(Graphics g)

View File

@ -16,17 +16,14 @@ namespace ProjectTank.Entities
/// Дополнительный цвет (для опциональных элементов) /// Дополнительный цвет (для опциональных элементов)
/// </summary> /// </summary>
public Color AdditionalColor { get; private set; } public Color AdditionalColor { get; private set; }
/// <summary> /// <summary>
/// Пушка /// Пушка
/// </summary> /// </summary>
public bool Gun { get; private set; } public bool Gun { get; private set; }
/// <summary> /// <summary>
/// Пулемет /// Пулемет
/// </summary> /// </summary>
public bool MachineGun { get; private set; } public bool MachineGun { get; private set; }
/// <summary> /// <summary>
/// Инициализация полей объекта-класса спортивного автомобиля /// Инициализация полей объекта-класса спортивного автомобиля
/// </summary> /// </summary>