Reveal Bombs when loose
This commit is contained in:
@@ -120,7 +120,7 @@ namespace CoopSweeper.GameTypes
|
|||||||
{
|
{
|
||||||
field.State = FieldState.REVEALED;
|
field.State = FieldState.REVEALED;
|
||||||
if (field.ContainsBomb)
|
if (field.ContainsBomb)
|
||||||
GameFinished?.Invoke(false);
|
FinishGame(false);
|
||||||
|
|
||||||
if (field.SurroundingBombs == 0)
|
if (field.SurroundingBombs == 0)
|
||||||
foreach (var surField in GetSorroundedFields(x, y))
|
foreach (var surField in GetSorroundedFields(x, y))
|
||||||
@@ -130,7 +130,26 @@ namespace CoopSweeper.GameTypes
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (CheckGameFinished())
|
if (CheckGameFinished())
|
||||||
GameFinished?.Invoke(true);
|
FinishGame(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RevealBombs()
|
||||||
|
{
|
||||||
|
|
||||||
|
for (int i = 0; i < Map.GetLength(0); i++)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < Map.GetLength(1); j++)
|
||||||
|
{
|
||||||
|
if (Map[i, j].ContainsBomb)
|
||||||
|
Map[i, j].State = FieldState.REVEALED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FinishGame(bool isWon)
|
||||||
|
{
|
||||||
|
RevealBombs();
|
||||||
|
GameFinished?.Invoke(isWon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reveal(int x, int y)
|
public void Reveal(int x, int y)
|
||||||
|
|||||||
Reference in New Issue
Block a user