лаб - 4

This commit is contained in:
Daniya_Youdakova 2022-12-15 22:43:00 +04:00
parent 75fa75b3eb
commit 1468070ed2
3 changed files with 1 additions and 7 deletions

View File

@ -22,7 +22,7 @@ dopColor, bool flightDeck, bool hangarDeck, bool route) :
} }
Pen pen = new(Color.Black); Pen pen = new(Color.Black);
Brush dopBrush = new SolidBrush(modernAircraftCarrier.DopColor); Brush dopBrush = new SolidBrush(modernAircraftCarrier.DopColor);
if (modernAircraftCarrier.FlightDeck) if (modernAircraftCarrier.FlightDeck)
{ {
g.DrawRectangle(pen, _startPosX + 10, _startPosY, 160, 10); g.DrawRectangle(pen, _startPosX + 10, _startPosY, 160, 10);

View File

@ -9,13 +9,9 @@ namespace AircraftCarrier
public class EntityAircraftCarrier public class EntityAircraftCarrier
{ {
public int Speed { get; private set; } public int Speed { get; private set; }
public float Weight { get; private set; } public float Weight { get; private set; }
public Color BodyColor { get; private set; } public Color BodyColor { get; private set; }
public float Step => Speed * 100 / Weight; public float Step => Speed * 100 / Weight;
public EntityAircraftCarrier(int speed, float weight, Color bodyColor) public EntityAircraftCarrier(int speed, float weight, Color bodyColor)
{ {
Random rnd = new Random(); Random rnd = new Random();
@ -23,6 +19,5 @@ namespace AircraftCarrier
Weight = weight <= 0 ? rnd.Next(40, 70) : weight; Weight = weight <= 0 ? rnd.Next(40, 70) : weight;
BodyColor = bodyColor; BodyColor = bodyColor;
} }
} }
} }

View File

@ -25,7 +25,6 @@ namespace AircraftCarrier
_aircraftcarrier?.DrawTransport(gr); _aircraftcarrier?.DrawTransport(gr);
pictureBoxAircraftCarrier.Image = bmp; pictureBoxAircraftCarrier.Image = bmp;
} }
private void SetData() private void SetData()
{ {
Random rnd = new(); Random rnd = new();