From 35d382d5867259128b8a1d7f7f30adf3e5f5f1a1 Mon Sep 17 00:00:00 2001 From: asoc1al Date: Sat, 7 Oct 2023 11:40:56 +0400 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81=D0=B8=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DumpTruck/DumpTruck/DrawingTruck.cs | 5 +++-- DumpTruck/DumpTruck/EntityTruck.cs | 8 +++++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/DumpTruck/DumpTruck/DrawingTruck.cs b/DumpTruck/DumpTruck/DrawingTruck.cs index ec65513..b369c3a 100644 --- a/DumpTruck/DumpTruck/DrawingTruck.cs +++ b/DumpTruck/DumpTruck/DrawingTruck.cs @@ -16,7 +16,7 @@ namespace DumpTruck private int _pictureHeight; protected readonly int _truckWidth = 100; protected readonly int _truckHeight = 50; - public bool Init(int speed, float weight, Color bodyColor, Color additionalColor, int width, int height) + public bool Init(int speed, float weight, Color bodyColor, Color additionalColor, int width, int height, bool threeWheels, bool dump) { if (width < _truckWidth || height < _truckHeight) { @@ -25,7 +25,7 @@ namespace DumpTruck _pictureWidth = width; _pictureHeight = height; EntityTruck = new EntityTruck(); - EntityTruck.Init(speed, weight, bodyColor, additionalColor); + EntityTruck.Init(speed, weight, bodyColor, additionalColor, threeWheels, dump); return true; } public void SetPosition(int x, int y) @@ -113,6 +113,7 @@ namespace DumpTruck g.DrawEllipse(pen, _startPosX + 22, _startPosY + 35, 20, 20); g.DrawEllipse(pen, _startPosX + 80, _startPosY + 35, 20, 20); + //Brush brBody = new SolidBrush(EntityTruck?.AdditionalColor ?? Color.Red); Brush brBodyAdditional = new SolidBrush(additionalColor); g.FillRectangle(brBodyAdditional, _startPosX + 0, _startPosY, 70, 30); diff --git a/DumpTruck/DumpTruck/EntityTruck.cs b/DumpTruck/DumpTruck/EntityTruck.cs index 793c885..8f9e4dc 100644 --- a/DumpTruck/DumpTruck/EntityTruck.cs +++ b/DumpTruck/DumpTruck/EntityTruck.cs @@ -16,14 +16,20 @@ namespace DumpTruck public Color BodyColor { get; private set; } public Color AdditionalColor { get; private set; } + public bool ThreeWheels { get; private set; } + + public bool Dump { get; private set; } + public float Step => Speed * 100 / Weight; - public void Init(int speed, float weight, Color bodyColor, Color additionalColor) + public void Init(int speed, float weight, Color bodyColor, Color additionalColor, bool threeWheels, bool dump) { Speed = speed; Weight = weight; BodyColor = bodyColor; AdditionalColor = additionalColor; + ThreeWheels = threeWheels; + Dump = dump; } } } \ No newline at end of file