diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs index 66df303..9b74014 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/DrawingSPAU.cs @@ -10,7 +10,7 @@ namespace SelfPropelledArtilleryUnit /// /// Класс, отвечающий за прорисовку и перемещение объекта-сущности /// - public class DrawningSPAU + public class DrawingSPAU { /// /// Класс-сущность @@ -47,14 +47,12 @@ namespace SelfPropelledArtilleryUnit /// Вес /// Цвет кузова /// Дополнительный цвет - /// Признак наличия обвеса - /// Признак наличия антикрыла - /// Признак наличия гоночной полосы + /// Признак наличия залповой установки /// Ширина картинки /// Высота картинки /// true - объект создан, false - проверка не пройдена,нельзя создать объект в этих размерах public bool Init(int speed, double weight, Color bodyColor, Color - additionalColor, bool bodyKit, bool wing, bool sportLine, int width, int height) + additionalColor, bool bodyKit, int width, int height) { _pictureWidth = width; _pictureHeight = height; @@ -68,7 +66,7 @@ namespace SelfPropelledArtilleryUnit } EntitySPAU = new EntitySPAU(); EntitySPAU.Init(speed, weight, bodyColor, additionalColor, - bodyKit, wing, sportLine); + bodyKit); return true; } /// @@ -78,7 +76,6 @@ namespace SelfPropelledArtilleryUnit /// Координата Y public void SetPosition(int x, int y) { - // TODO: Изменение x, y @ if (x < 0 || x > _pictureWidth - _carWidth) { x = 0; @@ -153,7 +150,7 @@ namespace SelfPropelledArtilleryUnit } //гусеницы Brush brBlack = new SolidBrush(Color.Black); - Brush br = new SolidBrush(EntitySPAU.BodyColor); + Brush brBody = new SolidBrush(EntitySPAU.BodyColor); g.FillEllipse(brBlack, _startPosX + 5, _startPosY + 50, 20, 20); g.FillEllipse(brBlack, _startPosX + 30, _startPosY + 50, 20, 20); g.FillEllipse(brBlack, _startPosX + 55, _startPosY + 50, 20, 20); @@ -166,7 +163,7 @@ namespace SelfPropelledArtilleryUnit pointsGun[1].X = _startPosX + 40; pointsGun[1].Y = _startPosY + 45; pointsGun[2].X = _startPosX + 135; pointsGun[2].Y = _startPosY + 5; pointsGun[3].X = _startPosX + 130; pointsGun[3].Y = _startPosY + 0; - g.FillPolygon(br, pointsGun); + g.FillPolygon(brBody, pointsGun); g.DrawPolygon(penBlack, pointsGun); //корпус Point[] pointsCorp = new Point[4]; @@ -174,7 +171,7 @@ namespace SelfPropelledArtilleryUnit pointsCorp[1].X = _startPosX + 10; pointsCorp[1].Y = _startPosY + 30; pointsCorp[2].X = _startPosX + 130; pointsCorp[2].Y = _startPosY + 30; pointsCorp[3].X = _startPosX + 135; pointsCorp[3].Y = _startPosY + 60; - g.FillPolygon(br, pointsCorp); + g.FillPolygon(brBody, pointsCorp); g.DrawPolygon(penBlack, pointsCorp); //башня Point[] pointsHead = new Point[4]; @@ -182,7 +179,7 @@ namespace SelfPropelledArtilleryUnit pointsHead[1].X = _startPosX + 45; pointsHead[1].Y = _startPosY + 15; pointsHead[2].X = _startPosX + 70; pointsHead[2].Y = _startPosY + 15; pointsHead[3].X = _startPosX + 75; pointsHead[3].Y = _startPosY + 30; - g.FillPolygon(br, pointsHead); + g.FillPolygon(brBody, pointsHead); g.DrawPolygon(penBlack, pointsHead); } } diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/EntitySPAU.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/EntitySPAU.cs index 0da6d2a..97c239b 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/EntitySPAU.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/EntitySPAU.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace SelfPropelledArtilleryUnit +namespace SelfPropelledArtilleryUnit { public class EntitySPAU { @@ -25,19 +19,11 @@ namespace SelfPropelledArtilleryUnit /// public Color AdditionalColor { get; private set; } /// - /// Признак (опция) наличия обвеса + /// Признак (опция) наличия залповой установки /// public bool BodyKit { get; private set; } /// - /// Признак (опция) наличия антикрыла - /// - public bool Wing { get; private set; } - /// - /// Признак (опция) наличия гоночной полосы - /// - public bool SportLine { get; private set; } - /// - /// Шаг перемещения автомобиля + /// Шаг перемещения САУ /// public double Step => (double)Speed * 100 / Weight; /// @@ -51,15 +37,13 @@ namespace SelfPropelledArtilleryUnit /// Признак наличия антикрыла /// Признак наличия гоночной полосы public void Init(int speed, double weight, Color bodyColor, Color - additionalColor, bool bodyKit, bool wing, bool sportLine) + additionalColor, bool bodyKit) { Speed = speed; Weight = weight; BodyColor = bodyColor; AdditionalColor = additionalColor; BodyKit = bodyKit; - Wing = wing; - SportLine = sportLine; } } } diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs index e91c33f..935f790 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Form.cs @@ -5,7 +5,7 @@ namespace SelfPropelledArtilleryUnit /// /// - /// - private DrawningSPAU? _drawningSPAU; + private DrawingSPAU? _drawningSPAU; /// /// /// @@ -38,7 +38,7 @@ namespace SelfPropelledArtilleryUnit private void buttonCreate_Click(object sender, EventArgs e) { Random random = new(); - _drawningSPAU = new DrawningSPAU(); + _drawningSPAU = new DrawingSPAU(); _drawningSPAU.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), @@ -46,8 +46,6 @@ namespace SelfPropelledArtilleryUnit Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)), Convert.ToBoolean(random.Next(0, 2)), - Convert.ToBoolean(random.Next(0, 2)), - Convert.ToBoolean(random.Next(0, 2)), pictureBoxSPAU.Width, pictureBoxSPAU.Height); _drawningSPAU.SetPosition(random.Next(10, 100), random.Next(10, 100)); @@ -57,7 +55,7 @@ namespace SelfPropelledArtilleryUnit private void buttonMove_Click(object sender, EventArgs e) { if(_drawningSPAU == null) -{ + { return; } string name = ((Button)sender)?.Name ?? string.Empty; diff --git a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Program.cs b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Program.cs index aabba24..960f82b 100644 --- a/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Program.cs +++ b/SelfPropelledArtilleryUnit/SelfPropelledArtilleryUnit/Program.cs @@ -8,8 +8,6 @@ namespace SelfPropelledArtilleryUnit [STAThread] static void Main() { - // To customize application configuration such as set high DPI settings or default font, - // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); Application.Run(new Form()); }