PIbd-23-Radaev-A.V.-20/Catamaran/DrawningCatamaranPro.cs

74 lines
3.3 KiB
C#
Raw Permalink Normal View History

2023-10-31 12:27:43 +04:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
public class DrawningCatamaranPro : DrawningCatamaran
{
public DrawningCatamaranPro(int speed, double weight, Color bodyColor,Color otherColor, Color additionalColor, bool bodyKit, bool motor, bool sheet, int width, int height, bool seats) :
base(speed, weight, bodyColor,additionalColor, width, height, seats)
{
if (EntityCatamaran != null)
{
EntityCatamaran = new EntityCatamaranPro(speed, weight, bodyColor, additionalColor,otherColor,bodyKit, motor, sheet, seats);
}
}
public override void DrawTransport(Graphics g)
{
if (EntityCatamaran is not EntityCatamaranPro CatPro)
{
return;
}
base.DrawTransport(g);
Pen pen = new(Color.Black);
Brush additionalBrush = new SolidBrush(CatPro.AdditionalColor);
Brush floatsBrush = new SolidBrush(CatPro.OtherColor);
if (CatPro.Motor)
{
g.FillRectangle(additionalBrush, _startPosX, _startPosY+25, 10, 30);
g.DrawRectangle(pen, _startPosX, _startPosY+25, 10, 30);
g.DrawRectangle(pen, _startPosX+5, _startPosY+30, 5, 20);
}
if(CatPro.BodyKit)
{
g.FillRectangle(floatsBrush, _startPosX, _startPosY, _catamaranWidth - 20, 10);
g.DrawRectangle(pen, _startPosX, _startPosY, _catamaranWidth - 20, 10);
g.FillRectangle(floatsBrush, _startPosX, _startPosY + 70, _catamaranWidth - 20, 10);
g.DrawRectangle(pen, _startPosX, _startPosY + 70, _catamaranWidth - 20, 10);
Point[] trig1 = { new Point(_startPosX + _catamaranWidth -20, _startPosY), new Point(_startPosX + _catamaranWidth, _startPosY + 5), new Point(_startPosX+_catamaranWidth - 20, _startPosY+10) };
g.DrawPolygon(pen, trig1);
Point[] trig2 = { new Point(_startPosX + _catamaranWidth - 20, _startPosY + 70), new Point(_startPosX + _catamaranWidth, _startPosY + 75), new Point(_startPosX + _catamaranWidth - 20, _startPosY + 80) };
g.DrawPolygon(pen, trig2);
}
if (CatPro.Sheet)
{
for (int i = 10; i< 100; i+=10)
{
Point point1 = new Point(_startPosX+i, _startPosY);
Point point2 = new Point(_startPosX+i, _startPosY+10);
g.DrawLine(pen, point1, point2);
}
for (int i = 10; i< 100; i+=10)
{
Point point3 = new Point(_startPosX+i, _startPosY+70);
Point point4 = new Point(_startPosX+i, _startPosY+_catamaranHeight);
g.DrawLine(pen, point3, point4);
}
}
Point[] points = { new Point(_startPosX + _catamaranWidth - 35, _startPosY+20), new Point(_startPosX + _catamaranWidth - 10, _startPosY + 40), new Point(_startPosX + _catamaranWidth - 35, _startPosY + 60) };
g.FillPolygon(additionalBrush, points);
g.DrawPolygon(pen, points);
}
}
}