Skip to content

Commit 3d02024

Browse files
committed
Clear tilemap on game over
1 parent f83de2b commit 3d02024

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Assets/Scripts/Board.cs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,19 @@ public void SpawnPiece()
3939
TetrominoData data = this.tetrominoes[random];
4040

4141
this.activePiece.Initialize(this, this.spawnPosition, data);
42-
Set(this.activePiece);
42+
43+
if (!IsValidPosition(this.activePiece, this.spawnPosition)) {
44+
GameOver();
45+
} else {
46+
Set(this.activePiece);
47+
}
48+
}
49+
50+
public void GameOver()
51+
{
52+
this.tilemap.ClearAllTiles();
53+
54+
// Do anything else you want on game over here..
4355
}
4456

4557
public void Set(Piece piece)

0 commit comments

Comments
 (0)