Фикс
This commit is contained in:
parent
f282067ee4
commit
e392583d50
@ -17,10 +17,9 @@ namespace WarmlyShip
|
|||||||
private readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля
|
private readonly int _warmlyShipHeight = 50; //Высота отрисовки корабля
|
||||||
|
|
||||||
//Инициализация
|
//Инициализация
|
||||||
public void Init(int speed, float weight, Color bodyColor)
|
public DrawingWarmlyShip(int speed, float weight, Color bodyColor)
|
||||||
{
|
{
|
||||||
warmlyShip = new EntityWarmlyShip();
|
warmlyShip = new EntityWarmlyShip(speed, weight, bodyColor);
|
||||||
warmlyShip.Init(speed, weight, bodyColor);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Начальные коордитанты
|
//Начальные коордитанты
|
||||||
|
@ -14,7 +14,7 @@ namespace WarmlyShip
|
|||||||
public float Step => Speed * 100 / Weight; //Шаг при перемещении
|
public float Step => Speed * 100 / Weight; //Шаг при перемещении
|
||||||
|
|
||||||
//Инициализация
|
//Инициализация
|
||||||
public void Init(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(50, 150) : speed;
|
||||||
|
@ -20,8 +20,7 @@ namespace WarmlyShip
|
|||||||
private void ButtonCreate_Click(object sender, EventArgs e)
|
private void ButtonCreate_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
_warmlyShip = new DrawingWarmlyShip();
|
_warmlyShip = new DrawingWarmlyShip(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||||
_warmlyShip.Init(random.Next(100, 300), random.Next(1000, 3000), Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
|
||||||
_warmlyShip.SetPosition(random.Next(10, 100), random.Next(10, 100), pictureBox.Width, pictureBox.Height);
|
_warmlyShip.SetPosition(random.Next(10, 100), random.Next(10, 100), pictureBox.Width, pictureBox.Height);
|
||||||
toolStripStatusSpeed.Text = $"Ñêîðîñòü: {_warmlyShip.warmlyShip?.Speed}";
|
toolStripStatusSpeed.Text = $"Ñêîðîñòü: {_warmlyShip.warmlyShip?.Speed}";
|
||||||
toolStripStatusWeight.Text = $"Âåñ: {_warmlyShip.warmlyShip?.Weight}";
|
toolStripStatusWeight.Text = $"Âåñ: {_warmlyShip.warmlyShip?.Weight}";
|
||||||
|
Loading…
Reference in New Issue
Block a user