Youdakova D.R. PIbd-21 LabWork05 #5
@ -66,7 +66,6 @@ namespace AircraftCarrier
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Direction.Down:
|
||||
xNumOfCells = (int)Math.Ceiling((Right - Left) / _size_x);
|
||||
yNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_y);
|
||||
@ -93,7 +92,6 @@ namespace AircraftCarrier
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Direction.Left:
|
||||
xNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_x);
|
||||
yNumOfCells = (int)Math.Ceiling((Bottom - Top) / _size_y);
|
||||
@ -120,13 +118,11 @@ namespace AircraftCarrier
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case Direction.Right:
|
||||
xNumOfCells = (int)Math.Ceiling(_drawningObject.Step / _size_x);
|
||||
yNumOfCells = (int)Math.Ceiling((Bottom - Top) / _size_y);
|
||||
xObjOffset = (int)(Right / _size_x);
|
||||
yObjOffset = (int)Math.Ceiling(Top / _size_y);
|
||||
|
||||
for (int i = 0; i < yNumOfCells; i++)
|
||||
{
|
||||
if (!roadIsClear)
|
||||
@ -148,7 +144,6 @@ namespace AircraftCarrier
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (roadIsClear)
|
||||
{
|
||||
_drawningObject.MoveObject(direction);
|
||||
@ -186,6 +181,7 @@ namespace AircraftCarrier
|
||||
y += (int)_size_y;
|
||||
yObjOffset = (int)(y / _size_y);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
private bool AreaIsFree(int xNumOfCells, int yNumOfCells, int xObjOffset, int yObjOffset)
|
||||
@ -206,7 +202,6 @@ namespace AircraftCarrier
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private Bitmap DrawMapWithObject()
|
||||
{
|
||||
Bitmap bmp = new(_width, _height);
|
||||
|
Loading…
Reference in New Issue
Block a user