コード例 #1
0
ファイル: AI.cs プロジェクト: dorog/UNE
    public override void SelectCard()
    {
        List <Card> validNextCards = CardValidator.GetAllValidNextCards(cards, discardPile.lastDiscardedCard.GetCard());

        if (validNextCards.Count == 0)
        {
            if (roundManager.PassRound(this))
            {
                drawPile.AddCard(this, 1);
            }
        }
        else
        {
            Card selectedCard = Select(validNextCards);
            if (roundManager.SelectCard(this, selectedCard))
            {
                Destroy(hand.GetChild(0).gameObject);

                int selectedCardIndex = cards.FindIndex(x => x == selectedCard);
                cards.RemoveAt(selectedCardIndex);

                CheckCardsState();

                SetGridSpacing(cards.Count);
            }
            else
            {
                Debug.LogError("AI picked invalid card!");
            }
        }
    }