示例#1
0
    // Show current player's turn
    public IEnumerator ShowDrawnCard(CardDisplay cardDisplay)
    {
        Card card = cardDisplay.GetCard();

        cardDisplay.SetIsDrawn();
        yield return(new WaitForSeconds(2));

        // Increment resource
        if (card.cardType == CardType.Resource)
        {
            C.Destroy(cardDisplay.gameObject);
        }

        // Add card piece display
        else
        {
            int newCardIndex = (handTransform.childCount + 1) / 2;
            cardDisplay.transform.SetParent(handTransform);
            cardDisplay.transform.SetSiblingIndex(newCardIndex);
        }


        // Remove new turn display and enable end turn button
        //currentTurnText.transform.parent.gameObject.SetActive(false);
        //endTurnButton.interactable = true;
    }
示例#2
0
        public void InitializesCard()
        {
            Card        card        = LoadTestUnitCard();
            Transform   transform   = new GameObject().transform;
            CardDisplay cardDisplay = CardDisplay.CreateCardDisplay(card, transform);

            Assert.IsNotNull(cardDisplay);
            Assert.AreEqual(cardDisplay.GetCard().cardName, "Wizard");
        }
示例#3
0
    // Show card display
    public void ShowCardDisplay(Card card)
    {
        try {
            // Do nothing if the card is the same
            if (currentCardDisplay.GetCard() == card)
            {
                return;
            }

            // Create a new card
            Destroy(currentCardDisplay.gameObject);
            currentCardDisplay = CardDisplay.CreateCardDisplay(card, cardDisplayPanel);
        }
        catch {
            // Create a new card
            currentCardDisplay = CardDisplay.CreateCardDisplay(card, cardDisplayPanel);
        }
    }
    // Show current player's turn
    public IEnumerator ShowDrawnCard(CardDisplay cardDisplay)
    {
        cardDisplay.SetIsDrawn();
        yield return(new WaitForSeconds(2));

        // Add non-resource cards to hand
        if (cardDisplay.GetCard().cardType != CardType.Resource)
        {
            handObject.AddDrawnCard((CardPieceDisplay)cardDisplay);
        }
        else
        {
            Destroy(cardDisplay.gameObject);
            resourceCounter.UpdateAllResources(player.GetResources());
        }

        // Remove new turn display and enable end turn button
        currentTurnText.transform.parent.gameObject.SetActive(false);
        endTurnButton.interactable = true;
    }
示例#5
0
 public void OnPointerClick(PointerEventData eventData)
 {
     gm.PrepareCard(cardDisplay.GetCard());
 }