예제 #1
0
 public void CreateDeck()
 {
     if (board != null)
     {
         return;
     }
     board = new BoardTable();
     board.CreateDeck();
     board.CreateBoardSettings();
 }
예제 #2
0
        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();
            }
        }