コード例 #1
0
        IEnumerator AiThinkCoroutine()
        {
            Card stackTopCard         = cardAnimator.GetStackTopCard();
            Card stackPreviousTopCard = cardAnimator.GetStackPreviousTopCard();

            selectedCardValues = gameDataManager.AiDecideCardFromPlayer(currentTurnPlayer, stackTopCard, stackPreviousTopCard);
            if (selectedCardValues.Count > 0)
            {
                selectedRank = Card.GetRank(selectedCardValues[0]);
            }

            //if (selectedCardValues.Count > 0 && Card.GetRank(selectedCardValues[0]) == Ranks.Ten)
            //{
            //    gameState = GameState.TurnSelectingNumber;
            //}
            //else
            //{
            yield return(new WaitForSeconds(UnityEngine.Random.Range(0.6f, 2.3f)));   //Wait

            gameState = GameState.TurnConfirmedSelectedNumber;
            //}
            GameFlow();
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: unix14/ShitHead
        private string isCardOkToThrow(CardAnimator cardAnimator, Card card)
        {
            if (card != null)
            {
                bool doIhaveAluckyCard = card.Rank == Ranks.Two || card.Rank == Ranks.Three || card.Rank == Ranks.Ten;
                Card topStackCard      = cardAnimator.GetStackTopCard();
                Card previousStackCard = cardAnimator.GetStackPreviousTopCard();

                if (topStackCard != null)
                {
                    if (topStackCard.Rank == Ranks.Ace)
                    {
                        if (card.Rank == Ranks.Ace || doIhaveAluckyCard)
                        {
                            if (card.Rank == Ranks.Ten)
                            {
                                Put10CardInStack(cardAnimator, card);
                                return("");
                            }
                            else
                            {
                                PutCardInStack(cardAnimator, card);
                                return("");
                            }
                        }
                        else
                        {
                            return("You need an Ace, or a lucky card");
                        }
                    }
                    else if (topStackCard.Rank == Ranks.Seven)
                    {
                        if (card.Rank <= Ranks.Seven && card.Rank != Ranks.Ace)
                        {
                            PutCardInStack(cardAnimator, card);
                            return("");
                        }
                        else if (doIhaveAluckyCard)
                        {
                            if (card.Rank == Ranks.Ten)
                            {
                                Put10CardInStack(cardAnimator, card);
                                return("");
                            }
                            else
                            {
                                PutCardInStack(cardAnimator, card);
                                return("");
                            }
                        }
                        else
                        {
                            return("You need smaller or equal card than 7, or a lucky card");
                        }
                    }
                    else if (topStackCard.Rank == Ranks.Two || card.Rank == Ranks.Ace || doIhaveAluckyCard)
                    {
                        if (card.Rank == Ranks.Ten)
                        {
                            Put10CardInStack(cardAnimator, card);
                            return("");
                        }
                        else
                        {
                            PutCardInStack(cardAnimator, card);
                            return("");
                        }
                    }
                    else if (topStackCard.Rank == Ranks.Three)
                    {
                        if (previousStackCard != null)
                        {
                            if (card.Rank >= previousStackCard.Rank && previousStackCard.Rank != Ranks.Ace)
                            {
                                PutCardInStack(cardAnimator, card);
                                return("");
                            }
                            else if (previousStackCard.Rank == Ranks.Ace && (card.Rank == Ranks.Ace || doIhaveAluckyCard))
                            {
                                if (card.Rank == Ranks.Ten)
                                {
                                    Put10CardInStack(cardAnimator, card);
                                    return("");
                                }
                                else
                                {
                                    PutCardInStack(cardAnimator, card);
                                    return("");
                                }
                            }
                            else
                            {
                                return("You need bigger card than " + previousStackCard.Rank + ", or a lucky card");
                            }
                        }
                        else
                        {
                            if (card.Rank >= Ranks.Three || (card.Rank == Ranks.Ace || doIhaveAluckyCard))
                            {
                                if (card.Rank == Ranks.Ten)
                                {
                                    Put10CardInStack(cardAnimator, card);
                                    return("");
                                }
                                else
                                {
                                    PutCardInStack(cardAnimator, card);
                                    return("");
                                }
                            }
                            else
                            {
                                return("You need bigger card than 3, or a lucky card");
                            }
                        }
                    }
                    else if (card.Rank >= topStackCard.Rank)
                    {
                        PutCardInStack(cardAnimator, card);
                        return("");
                    }
                    else
                    {
                        return("You need bigger card than " + topStackCard.Rank);
                    }
                }
                else
                {
                    PutCardInStack(cardAnimator, card);
                    return("");
                }
            }
            else
            {
                return("Unable to find displaying card.");
            }
        }