Первая лабораторная работа. Исправлена проверка SetPosition, название класса.

This commit is contained in:
ksenianeva 2022-10-03 21:50:34 +04:00
parent c61311f5b5
commit 4a3fdebbdf
2 changed files with 6 additions and 6 deletions

View File

@ -3,13 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static ContainerShip.EntityContainerShip;
using static ContainerShip.EntityShip;
namespace ContainerShip
{
internal class DrawingShip
{
public EntityContainerShip Ship { private set; get; }
public EntityShip Ship { private set; get; }
private float _startPosX;
private float _startPosY;
private int? _pictureWidth = null;
@ -35,7 +35,7 @@ namespace ContainerShip
/// <param name="bodyColor">Цвет кузова</param>
public void Init(int speed, float weight, Color bodyColor)
{
Ship = new EntityContainerShip();
Ship = new EntityShip();
Ship.Init(speed, weight, bodyColor);
}
@ -47,11 +47,11 @@ namespace ContainerShip
{
// Проверки
Random rn = new Random();
if (x < 0 || x > width)
if (x < 0 || x + _shipWidth> width)
{
x = rn.Next(0, width - _shipWidth);
}
if (y < 0 || y > height)
if (y < 0 || y + _shipHeight > height)
{
y = rn.Next(0, height - _shipHeight);
}

View File

@ -6,7 +6,7 @@ using System.Threading.Tasks;
namespace ContainerShip
{
internal class EntityContainerShip
internal class EntityShip
{
/// <summary>
/// Скорость