Доработано

This commit is contained in:
Hells Hound 2022-09-21 09:04:26 +04:00
parent 7e743b4b3b
commit 614a721e04

View File

@ -59,27 +59,14 @@ namespace AircraftCarrier
/// <param name="height"></param>
public void SetPosition(int x, int y, int width, int height)
{
_startPosX = x;
_startPosY = y;
_pictureWidth = width;
_pictureHeight = height;
if (width < _warshipWidth)
if (width >= x + _warshipWidth && height >= y + _warshipHeight && x >= 0 && y >= 0)
{
width = _warshipWidth;
}
if (height < _warshipHeight)
{
height = _warshipHeight;
}
if(x + _warshipWidth > width)
{
_startPosX -= x + _warshipWidth - width;
}
if (y + _warshipHeight > height)
{
_pictureHeight -= y + _warshipHeight - height;
_startPosX = x;
_startPosY = y;
_pictureWidth = width;
_pictureHeight = height;
}
else return;
}
/// <summary>
/// Изменение направления пермещения