Exemplo n.º 1
0
    public List <Card> CmdGetPlayerCards()
    {
        Debug.Log("Card Manager: getting card from deck.");
        List <Card> wReturnCards = new List <Card>();

        for (int idx = 0; idx < 6; idx++)
        {
            var wRandomCard = mDeck.GetRandomCard();

            wReturnCards.Add(wRandomCard);
        }
        return(wReturnCards);
    }
Exemplo n.º 2
0
        public void GetRandomCard_ShouldBeCard()
        {
            IDeckOfCards deck = new DeckOfCards();
            ICard        sut  = deck.GetRandomCard();

            Assert.NotNull(sut);
            Assert.IsInstanceOf <ICard>(sut);
        }
Exemplo n.º 3
0
    private void HandleColumn(IEnumerable <MatchXCardBehavior> cardsInColumn)
    {
        var cards = new MatchXCardBehavior[5];

        foreach (var c in cardsInColumn)
        {
            cards[c.Row] = c;
        }

        int selectedCount = 0;

        for (int i = cards.Length - 1; i >= 0; i--)
        {
            var card = cards[i];

            if (card.IsSelected)
            {
                int newRow = selectedCount;

                selectedCount++;
                var newCard = m_deck.GetRandomCard();
                if (newCard == null)
                { // when we're out of cards, do something special or something.
                    Debug.LogWarning("Out of cards");
                    foreach (var c in m_cards)
                    {
                        c.DropCard(c.Row - 1, c.Row);
                    }
                    m_acceptInput = false;
                    Dispatcher.PostDefault("You Won!", EDispatchMode.Batched);
                }
                var id = (newCard == null) ? -1 : newCard.CardId;
                card.RecycleCard(newRow, id);
            }
            else
            {
                card.SetRowWithAnimation(card.Row + selectedCount);
            }
        }
    }
Exemplo n.º 4
0
    // Start is called before the first frame update
    void Start111()
    {
        m_hands = new int[5][];

        m_siblings = transform.parent.GetComponentsInChildren <HandBehavior>().Select(_beh => _beh.gameObject).ToArray();

        for (int hand = 0; hand < 5; hand++)
        {
            m_hands[hand] = new int[5];
            for (int card = 0; card < 5; card++)
            {
                int cardId = m_deck.GetRandomCard().CardId;
                m_hands[hand][card] = cardId;

                Dispatcher.Default.Post(new CardDisplayRequest(card, hand, cardId), EDispatchMode.Batched);
            }
        }
    }