Ejemplo n.º 1
0
    void OnMouseDown()
    {
        if (deck.DeckCount() == 0)
        {
            return;
        }
        GameObject[] cards = deck.DrawCards(1);
        foreach (GameObject cardObject in cards)
        {
            Card c = cardObject.GetComponent <Card>();
            c.AnimateCard(transform, hand, 1.0f);
        }

        UpdateDeckDisplay();
    }
Ejemplo n.º 2
0
        public void DrawCards_drawTwoCards_deckHasTwoLessCards()
        {
            GameObject test = new GameObject();

            test.name = "DrawCards_drawTwoCards_deckHasTwoLessCards";
            GameObject  obj  = Helpers.MakeDeckObject(test.transform);
            DeckActions deck = obj.GetComponent <DeckActions> ();

            GameObject[] cardsToAdd = Helpers.MakeCards(4, test.transform);
            deck.AddCards(cardsToAdd);
            int deckCountBeforeDraw = deck.DeckCount();

            deck.DrawCards(2);

            int  deckCountAfterDraw = deck.DeckCount();
            bool deckIsTwoLess      = ((deckCountBeforeDraw - deckCountAfterDraw) == 2);

            Assert.That(deckIsTwoLess);
            GameObject.DestroyImmediate(test);
        }
Ejemplo n.º 3
0
        public void DrawCards_draw4CardsOutOfDeckOf2With2Discards_deckAndDiscardsEmpty()
        {
            GameObject test = new GameObject();

            test.name = "DrawCards_draw4CardsOutOfDeckOf2With2Discards_deckAndDiscardsEmpty";
            GameObject  obj  = Helpers.MakeDeckObject(test.transform);
            DeckActions deck = obj.GetComponent <DeckActions> ();

            GameObject[] cardsToAdd = Helpers.MakeCards(2, test.transform);
            deck.AddCards(cardsToAdd);
            GameObject[] cardsToDiscard = Helpers.MakeCards(2, test.transform);
            deck.DiscardCards(cardsToDiscard);

            deck.DrawCards(4);

            int deckCount    = deck.DeckCount();
            int discardCount = deck.DiscardCount();
            //Debug.Log (deckCount);
            //Debug.Log (discardCount);
            bool decksAreEmpty = (0 == (deckCount + discardCount));

            Assert.That(decksAreEmpty);
            GameObject.DestroyImmediate(test);
        }