示例#1
0
    public void GiveCard(Player player, bool showCard = true)
    {
        Card card = GetCard();

        CardDisplay display = GetDisplay(player.Transform);

        display.SetCard(card);

        player.Hand.AddCard(display);

        if (showCard)
        {
            display.FaceUp();
        }
    }
示例#2
0
    private void DrawCards(string playerId, string[] cardsIds)
    {
        for (int i = 0; i < cardsIds.Length; i++)
        {
            var         cardId        = cardsIds[i];
            var         cardTransform = cardIdToCards[cardId];
            CardDisplay cardDisplay   = cardTransform.GetComponent <CardDisplay>();

            this.playerStacks[playerId].hand.GetComponent <StackDisplay>().AddCard(cardDisplay);

            if (playerId == GameState.mainPlayerId)
            {
                cardDisplay.FaceUp();
            }
        }
    }
示例#3
0
    private CardDisplay CreateCardIn(CardData cardData, string playerId, Transform stack)
    {
        Transform newCard = (Transform)Instantiate(CardPrefab, new Vector2(0, 0), new Quaternion());

        cardIdToCards.Add(cardData.id, newCard);

        CardDisplay cardDisplay = newCard.GetComponent <CardDisplay>();

        cardsContainer.AddCard(cardDisplay);

        cardData.ownerId     = playerId;
        cardDisplay.cardData = cardData;

        stack.GetComponent <StackDisplay>().AddCard(cardDisplay);

        if (cardData.alive)
        {
            boardCreator.CreateUnit(cardDisplay, new Point(cardData.x, cardData.y));
        }

        if (stack.GetComponent <StackDisplay>().IsFaceUp)
        {
            cardDisplay.FaceUp();
        }
        else
        {
            cardDisplay.FaceDown();
        }

        if (cardData.tapped)
        {
            cardDisplay.Tap();
        }

        if (cardData.hero)
        {
            if (playerId == GameState.mainPlayerId)
            {
                boardCreator.allyHeroes.Add(cardDisplay);
            }
        }

        return(cardDisplay);
    }