Небольшие правки

This commit is contained in:
Галина Федоренко 2023-09-27 08:56:01 +04:00
parent 755c0d2dd2
commit b8af73b6a6

View File

@ -35,7 +35,7 @@ namespace Hydroplane
/// <summary>
/// Высота прорисовки гидроплана
/// </summary>
private readonly int _planeHeight = 100;
private readonly int _planeHeight = 80;
/// <summary>
/// Инициализация свойств
/// </summary>
@ -51,9 +51,12 @@ namespace Hydroplane
public bool Init(int speed, double weight, Color bodyColor, Color
additionalColor, bool boat, bool bobber, int width, int height)
{
// TODO: Продумать проверки
_pictureWidth = width;
_pictureHeight = height;
if (_pictureWidth < _planeWidth || _pictureHeight < _planeHeight)
{
return false;
}
EntityHydroplane = new EntityHydroplane();
EntityHydroplane.Init(speed, weight, bodyColor, additionalColor,
boat, bobber);
@ -67,9 +70,8 @@ namespace Hydroplane
/// <param name="y">Координата Y</param>
public void SetPosition(int x, int y)
{
// TODO: Изменение x, y
_startPosX = x;
_startPosY = y;
_startPosX = Math.Min(x, _pictureWidth - _planeWidth);
_startPosY = Math.Min(y, _pictureHeight - _planeHeight);
}
/// <summary>