diff --git a/ProjectTank/ProjectTank/Direction.cs b/ProjectTank/ProjectTank/DirectionType.cs similarity index 94% rename from ProjectTank/ProjectTank/Direction.cs rename to ProjectTank/ProjectTank/DirectionType.cs index 303cf57..7e6a2b7 100644 --- a/ProjectTank/ProjectTank/Direction.cs +++ b/ProjectTank/ProjectTank/DirectionType.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace ProjectTank -{ - public enum DirectionType - { - /// - /// Вверх - /// - Up = 1, - /// - /// Вниз - /// - Down = 2, - /// - /// Влево - /// - Left = 3, - /// - /// Вправо - /// - Right = 4 - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectTank +{ + public enum DirectionType + { + /// + /// Вверх + /// + Up = 1, + /// + /// Вниз + /// + Down = 2, + /// + /// Влево + /// + Left = 3, + /// + /// Вправо + /// + Right = 4 + } +} diff --git a/ProjectTank/ProjectTank/DrawningArmoredTransport.cs b/ProjectTank/ProjectTank/DrawningArmoredTransport.cs index 3effdab..ac81c1e 100644 --- a/ProjectTank/ProjectTank/DrawningArmoredTransport.cs +++ b/ProjectTank/ProjectTank/DrawningArmoredTransport.cs @@ -25,19 +25,19 @@ namespace ProjectTank.DrawningObjects /// private int _pictureHeight; /// - /// Левая координата прорисовки автомобиля + /// Левая координата прорисовки транспорта /// protected int _startPosX; /// - /// Верхняя кооридната прорисовки автомобиля + /// Верхняя кооридната прорисовки транспорта /// protected int _startPosY; /// - /// Ширина прорисовки автомобиля + /// Ширина прорисовки транспорта /// protected readonly int _transportWidth = 200; /// - /// Высота прорисовки автомобиля + /// Высота прорисовки транспорта /// protected readonly int _transportHeight = 80; /// @@ -65,14 +65,14 @@ namespace ProjectTank.DrawningObjects /// Ширина картинки /// Высота картинки public DrawningArmoredTransport(int speed, double weight, Color bodyColor, int - width, int height) + 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; } /// /// Конструктор @@ -82,19 +82,19 @@ namespace ProjectTank.DrawningObjects /// Основной цвет /// Ширина картинки /// Высота картинки - /// Ширина прорисовки автомобиля - /// Высота прорисовки автомобиля + /// Ширина прорисовки транспорта + /// Высота прорисовки транспорта protected DrawningArmoredTransport(int speed, double weight, Color bodyColor, int - width, int height, int transportWidth, int transportHeight) + 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); - } } /// /// Установка позиции @@ -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); diff --git a/ProjectTank/ProjectTank/DrawningObjectArmoredTransport.cs b/ProjectTank/ProjectTank/DrawningObjectArmoredTransport.cs index f8198ab..e7a51c9 100644 --- a/ProjectTank/ProjectTank/DrawningObjectArmoredTransport.cs +++ b/ProjectTank/ProjectTank/DrawningObjectArmoredTransport.cs @@ -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);