Теперь точно All Done

This commit is contained in:
asoc1al 2023-10-07 11:55:42 +04:00
parent 35d382d586
commit 992a9c2271
2 changed files with 19 additions and 11 deletions

View File

@ -81,7 +81,7 @@ namespace DumpTruck
} }
public void DrawTransport(Graphics g, Color bodyColor, Color additionalColor) public void DrawTransport(Graphics g, Color bodyColor, Color additionalColor, bool threeWheels, bool Dump)
{ {
if (EntityTruck == null) if (EntityTruck == null)
{ {
@ -96,13 +96,16 @@ namespace DumpTruck
g.FillRectangle(brBodyRandom, _startPosX, _startPosY + 30, 100, 5); g.FillRectangle(brBodyRandom, _startPosX, _startPosY + 30, 100, 5);
Brush brBlack = new SolidBrush(Color.Black); Brush brBlack = new SolidBrush(Color.Black);
g.FillEllipse(brBlack, _startPosX, _startPosY + 35, 20, 20); g.FillEllipse(brBlack, _startPosX, _startPosY + 35, 20, 20);
g.FillEllipse(brBlack, _startPosX + 22, _startPosY + 35, 20, 20); if (threeWheels)
g.FillEllipse(brBlack, _startPosX + 22, _startPosY + 35, 20, 20);
g.FillEllipse(brBlack, _startPosX + 80, _startPosY + 35, 20, 20); g.FillEllipse(brBlack, _startPosX + 80, _startPosY + 35, 20, 20);
Brush brWhite = new SolidBrush(Color.White); Brush brWhite = new SolidBrush(Color.White);
g.FillEllipse(brWhite, _startPosX + 5, _startPosY + 40, 10, 10); g.FillEllipse(brWhite, _startPosX + 5, _startPosY + 40, 10, 10);
g.FillEllipse(brWhite, _startPosX + 27, _startPosY + 40, 10, 10); if (threeWheels)
g.FillEllipse(brWhite, _startPosX + 27, _startPosY + 40, 10, 10);
g.FillEllipse(brWhite, _startPosX + 85, _startPosY + 40, 10, 10); g.FillEllipse(brWhite, _startPosX + 85, _startPosY + 40, 10, 10);
Pen pen = new Pen(Color.Black); Pen pen = new Pen(Color.Black);
@ -110,15 +113,20 @@ namespace DumpTruck
g.DrawRectangle(pen, _startPosX + 80, _startPosY, 20, 30); g.DrawRectangle(pen, _startPosX + 80, _startPosY, 20, 30);
g.DrawRectangle(pen, _startPosX, _startPosY + 30, 100, 5); g.DrawRectangle(pen, _startPosX, _startPosY + 30, 100, 5);
g.DrawEllipse(pen, _startPosX, _startPosY + 35, 20, 20); g.DrawEllipse(pen, _startPosX, _startPosY + 35, 20, 20);
g.DrawEllipse(pen, _startPosX + 22, _startPosY + 35, 20, 20); if (threeWheels)
g.DrawEllipse(pen, _startPosX + 22, _startPosY + 35, 20, 20);
g.DrawEllipse(pen, _startPosX + 80, _startPosY + 35, 20, 20); g.DrawEllipse(pen, _startPosX + 80, _startPosY + 35, 20, 20);
//Brush brBody = new SolidBrush(EntityTruck?.AdditionalColor ?? Color.Red); //Brush brBody = new SolidBrush(EntityTruck?.AdditionalColor ?? Color.Red);
Brush brBodyAdditional = new SolidBrush(additionalColor); if (Dump)
g.FillRectangle(brBodyAdditional, _startPosX + 0, _startPosY, 70, 30); {
Pen pen1 = new Pen(Color.Black); Brush brBodyAdditional = new SolidBrush(additionalColor);
g.DrawRectangle(pen1, _startPosX + 0, _startPosY, 70, 30); g.FillRectangle(brBodyAdditional, _startPosX + 0, _startPosY, 70, 30);
Pen pen1 = new Pen(Color.Black);
g.DrawRectangle(pen1, _startPosX + 0, _startPosY, 70, 30);
}
} }

View File

@ -27,7 +27,7 @@ namespace DumpTruck
Bitmap bmp = new(pictureBoxTruck.Width, Bitmap bmp = new(pictureBoxTruck.Width,
pictureBoxTruck.Height); pictureBoxTruck.Height);
Graphics gr = Graphics.FromImage(bmp); Graphics gr = Graphics.FromImage(bmp);
_drawningTruck.DrawTransport(gr, Color.FromArgb(0,255,128),Color.FromArgb(255,0,0)); _drawningTruck.DrawTransport(gr, Color.FromArgb(0,255,128),Color.FromArgb(255,0,0), false, true);
pictureBoxTruck.Image = bmp; pictureBoxTruck.Image = bmp;
} }
@ -40,7 +40,7 @@ namespace DumpTruck
{ {
Random random = new(); Random random = new();
_drawningTruck = new DrawingTruck(); _drawningTruck = new DrawingTruck();
_drawningTruck.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256)), Color.FromArgb(random.Next(0,256)), pictureBoxTruck.Width, pictureBoxTruck.Height); _drawningTruck.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256)), Color.FromArgb(random.Next(0,256)), pictureBoxTruck.Width, pictureBoxTruck.Height, Convert.ToBoolean(random.Next(2)), Convert.ToBoolean(random.Next(2)));
_drawningTruck.SetPosition(random.Next(1, 100), random.Next(1, 100)); _drawningTruck.SetPosition(random.Next(1, 100), random.Next(1, 100));
Draw(); Draw();
} }