fix destroyed walls count too high

This commit is contained in:
Vinzenz Schroeter 2024-04-21 19:34:22 +02:00
parent 3d69f592f6
commit 6045de0c7d
2 changed files with 8 additions and 5 deletions

View file

@ -104,5 +104,11 @@ internal sealed class Map(string name, bool[,] walls)
return false;
}
public void DestroyWallAt(PixelPosition pixel) => walls[pixel.X, pixel.Y] = false;
public bool TryDestroyWallAt(PixelPosition pixel)
{
var result = walls[pixel.X, pixel.Y];
if (result)
walls[pixel.X, pixel.Y] = false;
return result;
}
}