Edited from first lab

This commit is contained in:
vladimir_zinovev 2023-10-19 20:58:56 +04:00
parent 04570866d9
commit 803043d6b8
3 changed files with 47 additions and 48 deletions

View File

@ -25,19 +25,19 @@ namespace ProjectTank.DrawningObjects
/// </summary>
private int _pictureHeight;
/// <summary>
/// Левая координата прорисовки автомобиля
/// Левая координата прорисовки транспорта
/// </summary>
protected int _startPosX;
/// <summary>
/// Верхняя кооридната прорисовки автомобиля
/// Верхняя кооридната прорисовки транспорта
/// </summary>
protected int _startPosY;
/// <summary>
/// Ширина прорисовки автомобиля
/// Ширина прорисовки транспорта
/// </summary>
protected readonly int _transportWidth = 200;
/// <summary>
/// Высота прорисовки автомобиля
/// Высота прорисовки транспорта
/// </summary>
protected readonly int _transportHeight = 80;
/// <summary>
@ -67,12 +67,12 @@ namespace ProjectTank.DrawningObjects
public DrawningArmoredTransport(int speed, double weight, Color bodyColor, int
width, int height)
{
_pictureWidth = width;
_pictureHeight = height;
if ((_pictureHeight > _transportHeight) && (_pictureWidth > _transportWidth))
if ((height > _transportHeight) && (width > _transportWidth))
{
EntityArmoredTransport = new EntityArmoredTransport(speed, weight, bodyColor);
}
_pictureWidth = width;
_pictureHeight = height;
}
/// <summary>
/// Конструктор
@ -82,19 +82,19 @@ namespace ProjectTank.DrawningObjects
/// <param name="bodyColor">Основной цвет</param>
/// <param name="width">Ширина картинки</param>
/// <param name="height">Высота картинки</param>
/// <param name="transportWidth">Ширина прорисовки автомобиля</param>
/// <param name="transportHeight">Высота прорисовки автомобиля</param>
/// <param name="transportWidth">Ширина прорисовки транспорта</param>
/// <param name="transportHeight">Высота прорисовки транспорта</param>
protected DrawningArmoredTransport(int speed, double weight, Color bodyColor, int
width, int height, int transportWidth, int transportHeight)
{
if ((height > transportHeight) && (width > transportWidth))
{
EntityArmoredTransport = new EntityArmoredTransport(speed, weight, bodyColor);
}
_pictureWidth = width;
_pictureHeight = height;
_transportWidth = transportWidth;
_transportHeight = transportHeight;
if ((_pictureHeight > _transportHeight) && (_pictureWidth > _transportWidth))
{
EntityArmoredTransport = new EntityArmoredTransport(speed, weight, bodyColor);
}
}
/// <summary>
/// Установка позиции
@ -130,7 +130,7 @@ namespace ProjectTank.DrawningObjects
Brush blackColorBrush = new SolidBrush(Color.Black);
Brush bodyBrush = new SolidBrush(EntityArmoredTransport.BodyColor);
// Границы автомобиля
// Границы транспорта
// гусеницы
g.DrawEllipse(pen, _startPosX + 14, _startPosY + 44, 151, 31);
g.FillEllipse(blackColorBrush, _startPosX + 15, _startPosY + 45, 150, 30);

View File

@ -21,13 +21,12 @@ namespace ProjectTank.MovementStrategy
{
get
{
if (_drawningArmoredTransport == null || _drawningArmoredTransport.EntityArmoredTransport ==
null)
if (_drawningArmoredTransport == null || _drawningArmoredTransport.EntityArmoredTransport == null)
{
return null;
}
return new ObjectParameters(_drawningArmoredTransport.GetPosX,
_drawningArmoredTransport.GetPosY, _drawningArmoredTransport.GetWidth, _drawningArmoredTransport.GetHeight);
return new ObjectParameters(_drawningArmoredTransport.GetPosX, _drawningArmoredTransport.GetPosY,
_drawningArmoredTransport.GetWidth, _drawningArmoredTransport.GetHeight);
}
}
public int GetStep => (int)(_drawningArmoredTransport?.EntityArmoredTransport?.Step ?? 0);