2_Laba Kalyshev Y V PIbd-22 #3

Merged
eegov merged 6 commits from 2_Laba into 1_Laba 2022-09-30 11:28:06 +04:00
3 changed files with 4 additions and 6 deletions
Showing only changes of commit 8f21a3d0c4 - Show all commits

View File

@ -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>
/// Установка позиции автомобиля

View File

@ -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;

View File

@ -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}";