diff --git a/ProjectSportCar/ProjectSportCar/DrawningAiroplane.cs b/ProjectSportCar/ProjectSportCar/DrawningAiroplane.cs index 78ab71b..72ec0c1 100644 --- a/ProjectSportCar/ProjectSportCar/DrawningAiroplane.cs +++ b/ProjectSportCar/ProjectSportCar/DrawningAiroplane.cs @@ -39,7 +39,6 @@ public class DrawningAiroplane /// private readonly int _drawningaAiroplaneHeight = 110; - /// /// Инициализация свойств /// @@ -47,15 +46,14 @@ public class DrawningAiroplane /// Вес /// Основной цвет /// Дополнительный цвет - /// Признак наличия обвеса - /// Признак наличия антикрыла + /// Признак наличия бака + /// Признак наличия радара /// Признак наличия гоночной полосы public void Init(int speed, double weight, Color bodyColor, Color - additionalColor, bool bodyKit, bool wing, bool sportLine) + additionalColor, bool toplivbak, bool radar, bool sportLine) { EntityAiroplane = new EntityAiroplane(); - EntityAiroplane.Init(speed, weight, bodyColor, additionalColor, - bodyKit, wing, sportLine); + EntityAiroplane.Init(speed, weight, bodyColor, additionalColor, toplivbak, radar, sportLine); _pictureWidth = null; _pictureHeight = null; _startPosX = null; @@ -77,6 +75,20 @@ public bool SetPictureSize(int width, int height) { _pictureWidth = width; _pictureHeight = height; + + if (_startPosX.HasValue && _startPosY.HasValue) + { + if (_startPosX + _drawningAiroplaneWidth <= _pictureWidth) + { + _startPosX = 0; + } + + if (_startPosY + _drawningaAiroplaneHeight <= _pictureWidth) + { + _startPosY = 0; + } + + } return true; } return false; @@ -100,20 +112,22 @@ public bool SetPictureSize(int width, int height) { x = 0; } + else if (x + _drawningAiroplaneWidth > _pictureWidth.Value) { x = _pictureWidth.Value - _drawningAiroplaneWidth; } + if (y < 0) { y = 0; } + else if (y + _drawningaAiroplaneHeight > _pictureHeight.Value) { y = _pictureHeight.Value - _drawningaAiroplaneHeight; } - _startPosX = x; _startPosY = y; } @@ -189,7 +203,7 @@ public bool MoveTransport(DirectionType direction) //задняя часть самолета полукруг g.DrawArc(pen, _startPosX.Value + 20, _startPosY.Value + 60, 30,30,90,180); - //топливный бак + //сзади g.DrawEllipse(pen, _startPosX.Value + 25, _startPosY.Value + 55, 40,10); Brush brbr = new SolidBrush(Color.Brown); g.FillEllipse(brbr, _startPosX.Value + 25, _startPosY.Value + 55, 40,10); @@ -206,9 +220,8 @@ public bool MoveTransport(DirectionType direction) //вверх от тругольника до треугольника g.DrawLine(pen, _startPosX.Value + 70, _startPosY.Value + 60, _startPosX.Value + 150, _startPosY.Value + 60); - //крыло - g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 70, 70, 10); + g.DrawEllipse(pen, _startPosX.Value + 65, _startPosY.Value + 70, 70, 10); Brush brbl = new SolidBrush(Color.Black); g.FillEllipse(brbl, _startPosX.Value + 65, _startPosY.Value + 70, 70, 10); @@ -221,11 +234,26 @@ public bool MoveTransport(DirectionType direction) g.DrawEllipse(pen, _startPosX.Value + 60, _startPosY.Value + 95, 10, 10); g.DrawEllipse(pen, _startPosX.Value + 130, _startPosY.Value + 95, 10, 10); + //топливный бак + if (EntityAiroplane.Toplivbak) + { + g.FillRectangle(additionalBrush, _startPosX.Value + 80,_startPosY.Value + 45, 30, 15); + //g.FillRectangle(additionalBrush, _startPosX.Value + 35,_startPosY.Value + 23, 35, 15); + //g.FillRectangle(additionalBrush, _startPosX.Value + 10,_startPosY.Value + 23, 20, 15); + } + + //Радар + if (EntityAiroplane.Radar) + { + Brush brGreen = new SolidBrush(Color.LightGreen); + g.FillEllipse(brGreen, _startPosX.Value + 150, _startPosY.Value + 75, 10, 10); + g.DrawEllipse(pen, _startPosX.Value + 150, _startPosY.Value + 75, 10, 10); + } - //g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value +10, 20, 40); - //g.DrawRectangle(pen, _startPosX.Value + 90, _startPosY.Value,15, 15); - - // + //спортивная линия + if (EntityAiroplane.SportLine) { + g.FillRectangle(additionalBrush, _startPosX.Value + 138, _startPosY.Value + 60, 10, 30); + } } } diff --git a/ProjectSportCar/ProjectSportCar/EntityAiroplane.cs b/ProjectSportCar/ProjectSportCar/EntityAiroplane.cs index 240cb34..ab1c7ef 100644 --- a/ProjectSportCar/ProjectSportCar/EntityAiroplane.cs +++ b/ProjectSportCar/ProjectSportCar/EntityAiroplane.cs @@ -19,13 +19,13 @@ public class EntityAiroplane /// public Color AdditionalColor { get; private set; } /// - /// Признак (опция) наличия обвеса + /// Признак (опция) наличия бака /// - public bool BodyKit { get; private set; } + public bool Toplivbak { get; private set; } /// - /// Признак (опция) наличия антикрыла + /// Признак (опция) наличия радара // - public bool Wing { get; private set; } + public bool Radar { get; private set; } /// /// Признак (опция) наличия гоночной полосы /// @@ -41,17 +41,17 @@ public class EntityAiroplane /// /// /// - /// - /// + /// + /// /// - public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool bodyKit, bool wing, bool sportLine) + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, bool toplivbak, bool radar, bool sportLine) { Speed = speed; Weight = weight; BodyColor = bodyColor; AdditionalColor = additionalColor; - BodyKit = bodyKit; - Wing = wing; + Toplivbak = toplivbak; + Radar = radar; SportLine = sportLine; }