public void RestartGame() { for (int i = 0, iMax = board.Size; i < iMax; i++) { if (board[i].Card != null) { if (board[i].Card.IsGeneratedCard) { Card card = board[i].TakeCard(); GameObject.Destroy(card.gameObject); } else { ReturnCardFromSlot(board[i]); } } } while (waste.Size > 0) { if (waste[0].IsGeneratedCard) { Card card = waste.TakeTopCard(); GameObject.Destroy(card.gameObject); } else { ReturnCardFromWaste(); } } if (successfulRound) { round++; } else if (lives > 0) { lives--; } else { score = 0; round = 1; } undoHistory.Clear(); paused = false; successfulRound = false; timeRemaining = roundTime; GenerateDeck(); ArrangeBoard(); DealBoard(); }