Beispiel #1
0
        public void DrawCardFromReleasedDeck()
        {
            byte cardValue = gameDataManager.DrawFromReleasedDeck();

            cardAnimator.DrawReleasedCard(currentTurnPlayer, releasedDeck, cardValue);
            gameDataManager.AddCardValueToPlayer(currentTurnPlayer, cardValue);
            gameState = RummyGameStates.ReleaseCard;
        }
Beispiel #2
0
        //****************** User Interaction *********************//
        public void ReleaseSelectedCard(Card card)
        {
            Card current = card;

            if (gameState == RummyGameStates.ReleaseCard)
            {
                byte cardValue = (byte)card.cardValue;
                gameDataManager.ReleaseCardToReleasedDeck(cardValue, currentTurnPlayer);
                cardAnimator.MoveToReleasedDeck(currentTurnPlayer, releasedDeck, cardValue, current);

                gameState = RummyGameStates.TurnStarted;
            }
        }
Beispiel #3
0
        public void OnDealButtonClicked()
        {
            SetMessage($"Wait for your turn");
            dealButton.gameObject.SetActive(false);
            gameDataManager = new GameDataManager(localPlayer, remotePlayer);
            gameDataManager.Shuffle();
            gameDataManager.DealCardValuesToPlayer(localPlayer, Constants.PLAYER_INITIAL_CARDS);
            gameDataManager.DealCardValuesToPlayer(remotePlayer, Constants.PLAYER_INITIAL_CARDS);
            gameDataManager.DealCardToReleasedDeck(1);

            cardAnimator.DealDisplayingCards(localPlayer, Constants.PLAYER_INITIAL_CARDS);
            cardAnimator.DealDisplayingCards(remotePlayer, Constants.PLAYER_INITIAL_CARDS);
            cardAnimator.DealToReleasedDeck(releasedDeck, 1);
            //releasedDeck.ShowCardValues();

            gameState = RummyGameStates.TurnStarted;
        }
Beispiel #4
0
        //****************** Game Flow *********************//

        /*       public void GameFlow()
         *     {
         *         if (gameState > GameState.GameStarted)
         *         {
         *             CheckPlayersBooks();
         *             ShowAndHidePlayersDisplayingCards();
         *
         *             if (gameDataManager.GameFinished())
         *             {
         *                 gameState = GameState.GameFinished;
         *             }
         *         }
         *
         *         switch (gameState)
         *         {
         *             case GameState.Idel:
         *                 {
         *                     Debug.Log("IDEL");
         *                     break;
         *                 }
         *             case GameState.GameStarted:
         *                 {
         *                     Debug.Log("GameStarted");
         *                     OnGameStarted();
         *                     break;
         *                 }
         *             case GameState.TurnStarted:
         *                 {
         *                     Debug.Log("TurnStarted");
         *                     OnTurnStarted();
         *                     break;
         *                 }
         *             case GameState.TurnSelectingNumber:
         *                 {
         *                     Debug.Log("TurnSelectingNumber");
         *                     OnTurnSelectingNumber();
         *                     break;
         *                 }
         *             case GameState.TurnConfirmedSelectedNumber:
         *                 {
         *                     Debug.Log("TurnComfirmedSelectedNumber");
         *                     OnTurnConfirmedSelectedNumber();
         *                     break;
         *                 }
         *             case GameState.TurnWaitingForOpponentConfirmation:
         *                 {
         *                     Debug.Log("TurnWaitingForOpponentConfirmation");
         *                     OnTurnWaitingForOpponentConfirmation();
         *                     break;
         *                 }
         *             case GameState.TurnOpponentConfirmed:
         *                 {
         *                     Debug.Log("TurnOpponentConfirmed");
         *                     OnTurnOpponentConfirmed();
         *                     break;
         *                 }
         *             case GameState.TurnGoFish:
         *                 {
         *                     Debug.Log("TurnGoFish");
         *                     OnTurnGoFish();
         *                     break;
         *                 }
         *             case GameState.GameFinished:
         *                 {
         *                     Debug.Log("GameFinished");
         *                     OnGameFinished();
         *                     break;
         *                 }
         *         }
         *     }*/

        public void GameFlow()
        {
            if (gameState > RummyGameStates.GameStarted)
            {
                CheckPlayersBooks();
                ShowAndHidePlayersDisplayingCards();

                if (gameDataManager.GameFinished())
                {
                    gameState = RummyGameStates.GameOver;
                }
            }

            switch (gameState)
            {
            case RummyGameStates.Idle:
                Debug.Log("IDEL");
                break;

            case RummyGameStates.GameStarted:
                Debug.Log("GameStarted");
                OnGameStarted();
                break;

            case RummyGameStates.TurnStarted:
                Debug.Log("TurnStarted");
                OnTurnStarted();
                break;

            case RummyGameStates.DrawCard:
                Debug.Log("DrawCard");
                OnWaitForDrawStarted();
                break;

            case RummyGameStates.TurnOpponentConfirmed:
                Debug.Log("TurnOpponentConfirmed");
                OnTurnOpponentConfirmed();
                break;

            case RummyGameStates.GameOver:
                Debug.Log("GameFinished");
                OnGameFinished();
                break;
            }
        }
Beispiel #5
0
 void Start()
 {
     gameState = RummyGameStates.GameStarted;
     GameFlow();
 }
Beispiel #6
0
 void OnTurnStarted()
 {
     SwitchTurn();
     gameState = RummyGameStates.DrawCard;
     GameFlow();
 }