PIbd-21 Kryukov A.I Lab 1 Base #8
@ -31,11 +31,11 @@ namespace lab_1_pojectExcavator
|
||||
/// <summary>
|
||||
/// Ширина прорисовки автомобиля
|
||||
/// </summary>
|
||||
private readonly int _excavatorWidth = 190;
|
||||
private readonly int _excavatorWidth = 200;
|
||||
/// <summary>
|
||||
/// Высота прорисовки автомобиля
|
||||
/// </summary>
|
||||
private readonly int _excavatorHeight = 170;
|
||||
private readonly int _excavatorHeight = 150;
|
||||
/// <summary>
|
||||
/// Инициализация свойств
|
||||
/// </summary>
|
||||
@ -51,9 +51,12 @@ namespace lab_1_pojectExcavator
|
||||
public bool Init(int speed, double weight, Color bodyColor, Color
|
||||
additionalColor, bool bodyKit, bool backet,int width, int height)
|
||||
{
|
||||
// TODO: Продумать проверки
|
||||
_pictureWidth = width;
|
||||
_pictureHeight = height;
|
||||
if(_pictureHeight < _excavatorHeight || _pictureWidth < _excavatorWidth)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
EntityExcavator = new EntityExcavator();
|
||||
EntityExcavator.Init(speed, weight, bodyColor, additionalColor,bodyKit, backet);
|
||||
return true;
|
||||
@ -65,9 +68,9 @@ namespace lab_1_pojectExcavator
|
||||
/// <param name="y">Координата Y</param>
|
||||
public void SetPosition(int x, int y)
|
||||
{
|
||||
// TODO: Изменение x, y
|
||||
_startPosX = x;
|
||||
_startPosY = y;
|
||||
|
||||
_startPosX = Math.Min(x,_pictureWidth - _excavatorWidth);
|
||||
_startPosY = Math.Min(y,_pictureHeight - _excavatorHeight);
|
||||
|
||||
|
||||
}
|
||||
@ -106,7 +109,7 @@ namespace lab_1_pojectExcavator
|
||||
break;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
if (_startPosY + EntityExcavator.Step < _pictureHeight- _excavatorHeight)
|
||||
if (_startPosY + EntityExcavator.Step < _pictureHeight - _excavatorHeight)
|
||||
{
|
||||
_startPosY += (int)EntityExcavator.Step;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user