Kadyrov A.F. LabWork02 #2

Merged
eegov merged 4 commits from LabWork02 into LabWork1 2022-10-28 09:56:50 +04:00
4 changed files with 7 additions and 6 deletions
Showing only changes of commit 880d59a6e6 - Show all commits

View File

@ -45,10 +45,9 @@ namespace Battleship
/// <param name="speed">Скорость</param>
/// <param name="weight">Вес боевого корабля</param>
/// <param name="bodyColor">Цвет корпуса</param>
public void Init(int speed, float weight, Color bodyColor)
public DrawningBattleship(int speed, float weight, Color bodyColor)
{
Battleship = new EntityBattleship();
Battleship.Init(speed, weight, bodyColor);
Battleship = new EntityBattleship(speed, weight, bodyColor);
}
/// <summary>
/// Установка позиции боевого корабля

View File

@ -34,7 +34,7 @@ namespace Battleship
/// <param name="weight"></param>
/// <param name="bodyColor"></param>
/// <returns></returns>
public void Init(int speed, float weight, Color bodyColor)
public EntityBattleship(int speed, float weight, Color bodyColor)
{
Random rnd = new();
Speed = speed <= 0 ? rnd.Next(50, 150) : speed;

View File

@ -28,8 +28,7 @@ namespace Battleship
private void ButtonCreate_Click(object sender, EventArgs e)
{
Random rnd = new();
_battleship = new DrawningBattleship();
_battleship.Init(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_battleship = new DrawningBattleship(rnd.Next(100, 300), rnd.Next(1000, 2000), Color.FromArgb(rnd.Next(0, 256), rnd.Next(0, 256), rnd.Next(0, 256)));
_battleship.SetPosition(rnd.Next(10, 100), rnd.Next(10, 100), pictureBoxBattleship.Width, pictureBoxBattleship.Height);
toolStripStatusLabelSpeed.Text = $"Ñêîðîñòü: {_battleship.Battleship.Speed}";
toolStripStatusLabelWeight.Text = $"Âåñ: {_battleship.Battleship.Weight}";

View File

@ -60,4 +60,7 @@
<metadata name="statusStripBattleship.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>25</value>
</metadata>
</root>