Ejemplo n.º 1
0
    private void CardPlayed(CardBoardPartView _playedCardBoardArea)
    {
        Debug.LogFormat("GameController::CardPlayed");
        playerViewByNumber[CurrentPlayer].RemoveCard(_playedCardBoardArea.Card);
        playerViewByNumber[CurrentPlayer].Enable(false);

        turnResultByPhase = game.PlayCard(CurrentPlayer, _playedCardBoardArea.Card.Model, _playedCardBoardArea.BoardPosition);

        AnimatorFSM.SetTrigger(nextStateTriggerId);
    }
Ejemplo n.º 2
0
 private void FightState()
 {
     Debug.LogFormat("GameController::FightState");
     if (turnResultByPhase.TryGetValue(GamePhase.Normal, out currentPhaseResult))
     {
         ProcessWonCardsList(currentPhaseResult.cardWonList);
     }
     else
     {
         AnimatorFSM.SetTrigger(nextStateTriggerId);
     }
 }
Ejemplo n.º 3
0
    private void BetweenTurnState()
    {
        Debug.LogFormat("GameController::BetweenTurnState");
        playerViewByNumber[PlayerNumber.One].CurrentPlayerScore = game.GetPlayerByNumber(PlayerNumber.One).Score;
        playerViewByNumber[PlayerNumber.Two].CurrentPlayerScore = game.GetPlayerByNumber(PlayerNumber.Two).Score;

        if (game.IsOver)
        {
            AnimatorFSM.SetTrigger(gameOverTriggerId);
        }
        else
        {
            AnimatorFSM.SetTrigger(nextStateTriggerId);
        }
    }
Ejemplo n.º 4
0
    private void CardAnimationFinished(CardBoardPartView _cardTarget)
    {
        cardsRotationFinishedCount++;

        if (cardsRotationFinishedCount == cardsRotateCount)
        {
            cardsRotationFinishedCount = 0;
            cardsRotateCount           = 0;

            if (currentPhaseResult.comboCardList != null && currentPhaseResult.comboCardList.Count > 0)
            {
                Debug.LogFormat("GameController::CardAnimationFinished -> COMBO");
                SpecialRuleText comboRuleText = Instantiate(comboRuleTextPrefab, uiCanvas.transform);
                ProcessWonCardsList(currentPhaseResult.comboCardList.Dequeue());
            }
            else
            {
                AnimatorFSM.SetTrigger(nextStateTriggerId);
            }
        }
    }
Ejemplo n.º 5
0
    private void PlusRuleState()
    {
        Debug.LogFormat("GameController::PlusRuleState");
        if (turnResultByPhase.TryGetValue(GamePhase.Plus, out currentPhaseResult))
        {
            foreach (CardOnBoardWon cardWonItem in currentPhaseResult.cardWonList)
            {
                Vector2Int cardWonBoardPosition = cardWonItem.card.BoardPosition.Value;
                CardView   targetCardViewItem   = selectableAreasList[cardWonBoardPosition.x, cardWonBoardPosition.y].Card;
                targetCardViewItem.StartShinyAnimation();
            }

            SpecialRuleText plusRuleText = Instantiate(plusRuleTextPrefab, uiCanvas.transform);
            plusRuleText.OnAnimationFinished += () => {
                ProcessWonCardsList(currentPhaseResult.cardWonList);
            };
        }
        else
        {
            AnimatorFSM.SetTrigger(nextStateTriggerId);
        }
    }
Ejemplo n.º 6
0
 private void BeginGame()
 {
     randomArrow.OnAnimationComplete -= BeginGame;
     AnimatorFSM.SetTrigger(nextStateTriggerId);
 }