Доработано
This commit is contained in:
parent
7e743b4b3b
commit
614a721e04
@ -58,28 +58,15 @@ namespace AircraftCarrier
|
|||||||
/// <param name="width"></param>
|
/// <param name="width"></param>
|
||||||
/// <param name="height"></param>
|
/// <param name="height"></param>
|
||||||
public void SetPosition(int x, int y, int width, int height)
|
public void SetPosition(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
if (width >= x + _warshipWidth && height >= y + _warshipHeight && x >= 0 && y >= 0)
|
||||||
{
|
{
|
||||||
_startPosX = x;
|
_startPosX = x;
|
||||||
_startPosY = y;
|
_startPosY = y;
|
||||||
_pictureWidth = width;
|
_pictureWidth = width;
|
||||||
_pictureHeight = height;
|
_pictureHeight = height;
|
||||||
|
|
||||||
if (width < _warshipWidth)
|
|
||||||
{
|
|
||||||
width = _warshipWidth;
|
|
||||||
}
|
|
||||||
if (height < _warshipHeight)
|
|
||||||
{
|
|
||||||
height = _warshipHeight;
|
|
||||||
}
|
|
||||||
if(x + _warshipWidth > width)
|
|
||||||
{
|
|
||||||
_startPosX -= x + _warshipWidth - width;
|
|
||||||
}
|
|
||||||
if (y + _warshipHeight > height)
|
|
||||||
{
|
|
||||||
_pictureHeight -= y + _warshipHeight - height;
|
|
||||||
}
|
}
|
||||||
|
else return;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Изменение направления пермещения
|
/// Изменение направления пермещения
|
||||||
|
Loading…
Reference in New Issue
Block a user