Fix2
This commit is contained in:
parent
3e84127331
commit
fd9a9ed114
@ -56,17 +56,13 @@ namespace Ship
|
|||||||
private bool ObjectIntersects()
|
private bool ObjectIntersects()
|
||||||
{
|
{
|
||||||
var location = _drawingObject.GetCurrentPosition();
|
var location = _drawingObject.GetCurrentPosition();
|
||||||
Debug.WriteLine(location.Left + " " + location.Right + " " + location.Top + " " + location.Bottom);
|
|
||||||
for (int i = 0; i < _map.GetLength(0); i++)
|
for (int i = 0; i < _map.GetLength(0); i++)
|
||||||
{
|
{
|
||||||
for (int j = 0; j < _map.GetLength(1); j++)
|
for (int j = 0; j < _map.GetLength(1); j++)
|
||||||
{
|
{
|
||||||
if (_map[i, j] == _barrier)
|
if (_map[i, j] == _barrier)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Barrier found " + i * _size_x + " " + (i + 1) * _size_x + " " + j * _size_y + " " + (j+1)*_size_y + " " + (i * _size_x >= location.Left) + " " + ((i + 1) * _size_x <= location.Right) + " " + (j * _size_y >= location.Top) + " " + ((j + 1) * _size_y <= location.Bottom));
|
|
||||||
if (i * _size_x >= location.Left && (i + 1) * _size_x <= location.Right && j * _size_y >= location.Top && (j + 1) * _size_y <= location.Bottom)
|
|
||||||
{
|
{
|
||||||
Debug.WriteLine("True");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user