private IEnumerator CallEndGame() { if (!Application.isEditor) { WritePlayerData(); } ResetGameButton.gameObject.SetActive(false); yield return(new WaitForSeconds(1.5f)); FlipAllCards(); if (rankingController.IsTop20(GetTotalScore()) && playerName != "") { rankingController.RefreshRanking(playerName, GetTotalScore(), rankingController.GetTop20Position(GetTotalScore())); } yield return(new WaitForSeconds(1.5f)); ToggleCardsRenderer(); ResetGameButton.gameObject.SetActive(true); DeactivateInGameUI(); ActivateEndGameUI(); currentState = GameStates.End; endGameCalled = false; }