From 2b42cbf8bc03c05da6f0707dccc0ebab2cfb28e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=BB=D0=B0=D0=B4=D0=B8=D0=BC=D0=B8=D1=80=20=D0=94?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=BB=D0=BE=D0=B2?= Date: Fri, 27 Oct 2023 20:04:01 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D1=82=D0=B5=D0=BD=D1=82=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Project_DumpTruck/DrawningDumpTruck.cs | 10 ++++++++-- Project_DumpTruck/Project_DumpTruck/EntityDumpTruck.cs | 8 +++++++- .../Project_DumpTruck/FormDumpTruck.Designer.cs | 4 ++-- Project_DumpTruck/Project_DumpTruck/FormDumpTruck.cs | 1 + 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/Project_DumpTruck/Project_DumpTruck/DrawningDumpTruck.cs b/Project_DumpTruck/Project_DumpTruck/DrawningDumpTruck.cs index 469af20..1e1e3ab 100644 --- a/Project_DumpTruck/Project_DumpTruck/DrawningDumpTruck.cs +++ b/Project_DumpTruck/Project_DumpTruck/DrawningDumpTruck.cs @@ -46,7 +46,7 @@ namespace Project_DumpTruck /// /// Ширина картинки /// Высота картинки - public bool Init(int speed, float weight, Color bodyColor, Color additionalColor, bool body, int width, int height) + public bool Init(int speed, float weight, Color bodyColor, Color additionalColor, bool body, bool tent, int width, int height) { // TODO: Продумать проверки if (width < _dumptruckWidth || height < _dumptruckHeight) @@ -56,7 +56,7 @@ namespace Project_DumpTruck _pictureHeight = height; EntityDumpTruck = new EntityDumpTruck(); - EntityDumpTruck.Init(speed, weight, bodyColor, additionalColor, body); + EntityDumpTruck.Init(speed, weight, bodyColor, additionalColor, body, tent); return true; } /// @@ -161,6 +161,12 @@ namespace Project_DumpTruck { g.FillRectangle(brushAdditionalColor, _startPosX, _startPosY + 10, 70, 20); g.DrawRectangle(penBlack, _startPosX, _startPosY + 10, 70, 20); + + if (EntityDumpTruck.Tent) + { + g.FillRectangle(brushWhite, _startPosX, _startPosY + 10, 70, 5); + g.DrawRectangle(penBlack, _startPosX, _startPosY + 10, 70, 5); + } } } /// diff --git a/Project_DumpTruck/Project_DumpTruck/EntityDumpTruck.cs b/Project_DumpTruck/Project_DumpTruck/EntityDumpTruck.cs index 50aee12..a6b95c3 100644 --- a/Project_DumpTruck/Project_DumpTruck/EntityDumpTruck.cs +++ b/Project_DumpTruck/Project_DumpTruck/EntityDumpTruck.cs @@ -33,6 +33,11 @@ namespace Project_DumpTruck /// public bool BodyKit { get; private set; } + /// + /// Признак (опция) наличия тента + /// + public bool Tent { get; private set; } + /// /// Шаг перемещения автомобиля /// @@ -46,13 +51,14 @@ namespace Project_DumpTruck /// /// /// - public void Init(int speed, float weight, Color bodyColor, Color additionalColor, bool bodyKit) + public void Init(int speed, float weight, Color bodyColor, Color additionalColor, bool bodyKit, bool tent) { Speed = speed; Weight = weight; BodyColor = bodyColor; AdditionalColor = additionalColor; BodyKit = bodyKit; + Tent = tent; } } } diff --git a/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.Designer.cs b/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.Designer.cs index 4b29ca5..d615664 100644 --- a/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.Designer.cs +++ b/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.Designer.cs @@ -106,7 +106,7 @@ buttonRight.UseVisualStyleBackColor = true; buttonRight.Click += buttonMove_Click; // - // Form1 + // FormDumpTruck // AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleMode = AutoScaleMode.Font; @@ -117,7 +117,7 @@ Controls.Add(buttonLeft); Controls.Add(buttonCreate); Controls.Add(pictureBoxDumpTruck); - Name = "Form1"; + Name = "FormDumpTruck"; StartPosition = FormStartPosition.CenterScreen; Text = "Form1"; ((System.ComponentModel.ISupportInitialize)pictureBoxDumpTruck).EndInit(); diff --git a/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.cs b/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.cs index b5c8836..4881247 100644 --- a/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.cs +++ b/Project_DumpTruck/Project_DumpTruck/FormDumpTruck.cs @@ -43,6 +43,7 @@ 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)), pictureBoxDumpTruck.Width, pictureBoxDumpTruck.Height); _drawningDumpTruck.SetPosition(random.Next(10, 100), random.Next(10, 100));