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