2_Laba Kalyshev Y V PIbd-22 #3
@ -42,10 +42,9 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес автомобиля</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public DrawningBoat(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Boat = new EntityBoat();
|
||||
Boat.Init(speed, weight, bodyColor);
|
||||
Boat = new EntityBoat(speed, weight, bodyColor);
|
||||
}
|
||||
/// <summary>
|
||||
/// Установка позиции автомобиля
|
||||
|
@ -12,7 +12,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base
|
||||
public float Weight { get; private set; }
|
||||
public Color BodyColor { get; private set; }
|
||||
public float Step => Speed * 100 / Weight;
|
||||
public void Init(int speed, float weight, Color bodyColor)
|
||||
public EntityBoat(int speed, float weight, Color bodyColor)
|
||||
{
|
||||
Random rnd = new();
|
||||
Speed = speed <= 0 ? rnd.Next(5, 30) : speed;
|
||||
|
@ -26,8 +26,7 @@ namespace PIbd_22_Kalyshev_Y_V_MotorBoat_Base.git
|
||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||
{
|
||||
Random rnd = new();
|
||||
_boat = new DrawningBoat();
|
||||
_boat.Init(rnd.Next(5, 30), rnd.Next(30, 100), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
_boat = new DrawningBoat(rnd.Next(5, 30), rnd.Next(30, 100), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
|
||||
_boat.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxBoat.Width, pictureBoxBoat.Height);
|
||||
toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü: {_boat.Boat.Speed}";
|
||||
toolStripStatusLabelWeight.Text = $"Âåñ: {_boat.Boat.Weight}";
|
||||
|
Loading…
Reference in New Issue
Block a user