diff --git a/AntiAirCraftGun/AntiAirCraftGun/DrawingAntiAirCraftGun.cs b/AntiAirCraftGun/AntiAirCraftGun/DrawingAntiAirCraftGun.cs index 68ac91f..e1b597f 100644 --- a/AntiAirCraftGun/AntiAirCraftGun/DrawingAntiAirCraftGun.cs +++ b/AntiAirCraftGun/AntiAirCraftGun/DrawingAntiAirCraftGun.cs @@ -52,13 +52,13 @@ namespace AntiAircraftGun /// true - объект создан, false - проверка не пройдена, ///нельзя создать объект в этих размерах public bool Init(int speed, double weight, Color bodyColor, Color - additionalColor, int width, int height) + additionalColor, Color dopColor, bool rocket, bool radar, int width, int height) { // TODO: Продумать проверки _pictureWidth = width; _pictureHeight = height; AntiAircraftGun = new EntityAntiAircraftGun(); - AntiAircraftGun.Init(speed, weight, bodyColor, additionalColor); + AntiAircraftGun.Init(speed, weight, bodyColor, additionalColor,dopColor,rocket,radar); return true; } /// @@ -136,30 +136,42 @@ namespace AntiAircraftGun Brush bodyBrush = new SolidBrush(AntiAircraftGun.BodyColor); Brush additionalBrush = new SolidBrush(AntiAircraftGun.AdditionalColor); - // Нарисовать гусеницы + g.FillEllipse(additionalBrush, _startPosX, _startPosY+40, 110, 10); g.DrawEllipse(pen, _startPosX, _startPosY+40, 110, 10); g.FillRectangle(bodyBrush, _startPosX, _startPosY+30, 110, 10); g.DrawRectangle(pen, _startPosX, _startPosY+30, 110, 10); g.FillRectangle(bodyBrush, _startPosX+80, _startPosY+10, 30, 20); g.DrawRectangle(pen, _startPosX+80, _startPosY+10, 30, 20); - - points[0] = new Point(_startPosX, _startPosY+30); - points[1] = new Point(_startPosX+95, _startPosY+5); - points[2] = new Point(_startPosX+92, _startPosY); - points[3] = new Point(_startPosX, _startPosY+25); - g.FillPolygon(additionalBrush, points); - g.DrawPolygon(pen, points); - //g.DrawLine(pen, _startPosX, _startPosY+30, _startPosX+95,_startPosY+5 ); - //g.DrawLine(pen, _startPosX+95, _startPosY+5, _startPosX+92, _startPosY); - //g.DrawLine(pen, _startPosX+92, _startPosY, _startPosX, _startPosY+26); - //g.DrawLine(pen, _startPosX, _startPosY+26, _startPosX, _startPosY+30); for (int i = 0; i < 4; i++) { - Rectangle trackRect = new Rectangle(_startPosX+20 + i*19, _startPosY+40,10, 10); + Rectangle trackRect = new Rectangle(_startPosX+20 + i*19, _startPosY+40, 10, 10); g.DrawEllipse(pen, trackRect); g.FillEllipse(Brushes.Black, trackRect); } + + + Brush dopBrush = new SolidBrush(AntiAircraftGun.DopColor); + Pen dopPen = new Pen(AntiAircraftGun.DopColor); + if (AntiAircraftGun.Rocket) + { + points[0] = new Point(_startPosX, _startPosY + 30); + points[1] = new Point(_startPosX + 95, _startPosY + 5); + points[2] = new Point(_startPosX + 92, _startPosY); + points[3] = new Point(_startPosX, _startPosY + 25); + g.FillPolygon(dopBrush, points); + g.DrawPolygon(pen, points); + } + if (AntiAircraftGun.Radar) + { + g.DrawLine(dopPen, _startPosX + 105, _startPosY + 20, _startPosX +105, _startPosY + 5); + g.FillPie(dopBrush, _startPosX + 81, _startPosY-15, 30, 30, -45, 180); + g.DrawLine(dopPen, _startPosX + 98, _startPosY, _startPosX + 93, _startPosY + 10); + g.FillEllipse(dopBrush, _startPosX + 88, _startPosY -10, 10, 10); + } + + + diff --git a/AntiAirCraftGun/AntiAirCraftGun/EntityAntiAircraftGun.cs b/AntiAirCraftGun/AntiAirCraftGun/EntityAntiAircraftGun.cs index 6368799..9e0de1e 100644 --- a/AntiAirCraftGun/AntiAirCraftGun/EntityAntiAircraftGun.cs +++ b/AntiAirCraftGun/AntiAirCraftGun/EntityAntiAircraftGun.cs @@ -28,6 +28,12 @@ namespace AntiAircraftGun /// Шаг перемещения автомобиля /// public double Step => (double)Speed * 100 / Weight; + + public Color DopColor { get; private set; } + + public bool Rocket { get; private set; } + + public bool Radar { get; private set; } /// /// Инициализация полей объекта-класса спортивного автомобиля /// @@ -35,12 +41,15 @@ namespace AntiAircraftGun /// Вес автомобиля /// Основной цвет - public void Init(int speed, double weight, Color bodyColor, Color additionalColor) + public void Init(int speed, double weight, Color bodyColor, Color additionalColor, Color dopColor, bool rocket, bool radar) { Speed = speed; Weight = weight; BodyColor = bodyColor; AdditionalColor = additionalColor; + DopColor = dopColor; + Rocket = rocket; + Radar = radar; } } } diff --git a/AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.cs b/AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.cs index 895da78..4f42f5b 100644 --- a/AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.cs +++ b/AntiAirCraftGun/AntiAirCraftGun/FormAntiAirCraftGun.cs @@ -102,6 +102,10 @@ namespace AntiAircraftGun random.Next(0, 256)), Color.FromArgb(random.Next(0, 256), random.Next(0, 256),//. random.Next(0, 256)), + + Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), // . 2 + Convert.ToBoolean(random.Next(2)), // Rocket + Convert.ToBoolean(random.Next(2)), // Radar pictureBoxAntiAircraftGun.Width, pictureBoxAntiAircraftGun.Height); _drawing.SetPosition(random.Next(10, 100),