public void RemoveBlockFromGrid(int i, int j, BlockType blockType) { gridMap[i, j] = false; gridMap[i + blockType.GetWidth() - 1, j] = false; gridMap[i, j + blockType.GetHeight() - 1] = false; gridMap[i + blockType.GetWidth() - 1, j + blockType.GetHeight() - 1] = false; }
private bool TrySetBlock(bool[,] map, int i, int j, BlockType blockType) { if(i + blockType.GetWidth() - 1 >= columns || j + blockType.GetHeight() - 1 >= rows || map[i, j] || map[i + blockType.GetWidth() - 1, j] || map[i, j + blockType.GetHeight() - 1] || map[i + blockType.GetWidth() - 1, j + blockType.GetHeight() - 1]) { return false; } map[i, j] = true; map[i + blockType.GetWidth() - 1, j] = true; map[i, j + blockType.GetHeight() - 1] = true; map[i + blockType.GetWidth() - 1, j + blockType.GetHeight() - 1] = true; return true; }