Готово

This commit is contained in:
Макс Бондаренко 2022-11-11 16:06:26 +04:00
parent c94df016de
commit 117d18566a
3 changed files with 4 additions and 5 deletions

View File

@ -43,8 +43,7 @@ namespace WarmlyShip
public DrawningMotorShip ModifShip(int? speed = null, float? weight = null, Color? bodyColor = null, Color? dopColor = null, bool? tubes = null, bool? cistern = null) public DrawningMotorShip ModifShip(int? speed = null, float? weight = null, Color? bodyColor = null, Color? dopColor = null, bool? tubes = null, bool? cistern = null)
{ {
EntityMotorShip motorShip = (EntityMotorShip)warmlyShip; return new DrawningMotorShip(speed ?? warmlyShip.Speed, weight ?? warmlyShip.Weight, bodyColor ?? warmlyShip.BodyColor, dopColor ?? ((EntityMotorShip)warmlyShip).DopColor, tubes ?? ((EntityMotorShip)warmlyShip).Tubes, cistern ?? ((EntityMotorShip)warmlyShip).Cistern);
return new DrawningMotorShip(speed ?? warmlyShip.Speed, weight ?? warmlyShip.Weight, bodyColor ?? warmlyShip.BodyColor, dopColor ?? motorShip.DopColor, tubes ?? motorShip.Tubes, cistern ?? motorShip.Cistern);
} }
} }
} }

View File

@ -17,8 +17,8 @@ namespace WarmlyShip
public EntityWarmlyShip(int speed, float weight, Color bodyColor) public EntityWarmlyShip(int speed, float weight, Color bodyColor)
{ {
Random random = new Random(); Random random = new Random();
Speed = speed <= 0 ? random.Next(50, 150) : speed; Speed = speed <= 0 ? random.Next(100, 300) : speed;
Weight = weight <= 0 ? random.Next(40, 70) : weight; Weight = weight <= 0 ? random.Next(1000, 2000) : weight;
BodyColor = bodyColor; BodyColor = bodyColor;
} }
} }

View File

@ -23,7 +23,7 @@ namespace WarmlyShip
panelBlack.MouseDown += PanelColor_MouseDown; panelBlack.MouseDown += PanelColor_MouseDown;
panelPink.MouseDown += PanelColor_MouseDown; panelPink.MouseDown += PanelColor_MouseDown;
panelGreen.MouseDown += PanelColor_MouseDown; panelGreen.MouseDown += PanelColor_MouseDown;
panelGreen.MouseDown += PanelColor_MouseDown; panelCyan.MouseDown += PanelColor_MouseDown;
panelRed.MouseDown += PanelColor_MouseDown; panelRed.MouseDown += PanelColor_MouseDown;
panelWhite.MouseDown += PanelColor_MouseDown; panelWhite.MouseDown += PanelColor_MouseDown;
panelYellow.MouseDown += PanelColor_MouseDown; panelYellow.MouseDown += PanelColor_MouseDown;