auto reveal
This commit is contained in:
@@ -108,26 +108,36 @@ namespace CoopSweeper.GameTypes
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Reveal(int x, int y)
|
||||
private void InternalReveal(int x, int y)
|
||||
{
|
||||
CheckMap();
|
||||
var field = Map[x, y];
|
||||
//if (field.CheckID < _checkID)
|
||||
// return;
|
||||
if (field.CheckID == _checkID)
|
||||
return;
|
||||
|
||||
field.CheckID = _checkID;
|
||||
|
||||
if (field.State != FieldState.REVEALED)
|
||||
{
|
||||
field.State = FieldState.REVEALED;
|
||||
if (field.ContainsBomb)
|
||||
GameFinished?.Invoke(false);
|
||||
|
||||
if (field.SurroundingBombs == 0)
|
||||
foreach (var surField in GetSorroundedFields(x, y))
|
||||
{
|
||||
InternalReveal(surField.X, surField.Y);
|
||||
}
|
||||
}
|
||||
|
||||
if (CheckGameFinished())
|
||||
GameFinished?.Invoke(true);
|
||||
}
|
||||
|
||||
//_checkID
|
||||
public void Reveal(int x, int y)
|
||||
{
|
||||
CheckMap();
|
||||
_checkID++;
|
||||
InternalReveal(x, y);
|
||||
}
|
||||
|
||||
public void ToggleMark(int x, int y)
|
||||
|
||||
Reference in New Issue
Block a user