public void CreateDeck() { if (board != null) { return; } board = new BoardTable(); board.CreateDeck(); board.CreateBoardSettings(); }
private IEnumerator CheckCardsMatch(GameCard[] cards) { if (CompareCards(cards)) { foreach (GameCard card in cards) { board.RecycleGameCard(card); } yield return(new WaitForSeconds(1f)); GameVariables.AddScore(cards.Length * GameVariables.PairCardValue); GameVariables.AddBonusTime(); GameVariables.ApplyScoreMultiplier(); GameVariables.CountMatchedPair(); MemoramaUI.Instance.UpdatePlayerUI(UIPlayerInfo.GAME_SCORE, GameVariables.Score.ToString()); BoardTable.DestroyCards(cards); } else { yield return(new WaitForSeconds(1f)); GameVariables.ResetScoreMultiplier(); BoardTable.HideCards(cards); } Player.Instance.EnableCardinteraction(); if (!board.HasActiveCards()) { yield return(new WaitForSeconds(1)); while (GameVariables.GamePhase != GamePhases.IN_GAME) { yield return(new WaitForFixedUpdate()); } EndGame(); } }