Esempio n. 1
0
    public bool ReceiveCard(Card card)
    {
        Debug.Log($"Cards Count {Cards.Count}");
        if (Cards.Count == MAX_CARDS)
        {
            return(false);
        }

        if (card.CardType == CardType.DRAGON && Owner == PlayerInfoScene.Instance.playerId)
        {
            float      angle        = 450 - 180 * Owner;
            GameObject physicalCard = physicalCardGenerator.CreateCard(Cards.Count, (CardDragon)card, angle: angle);
            card.PhysicInstance = physicalCard;
            physicalCard.GetComponent <PhysicalCardInteractor>().virtualCard = card;
        }
        if (card.CardType == CardType.SPELL && Owner == PlayerInfoScene.Instance.playerId)
        {
            float      angle        = 450 - 180 * Owner;
            GameObject physicalCard = physicalCardGenerator.CreateCard(Cards.Count, (CardSpell)card, angle: angle);
            card.PhysicInstance = physicalCard;
            physicalCard.GetComponent <PhysicalCardInteractor>().virtualCard = card;
        }

        card.Index = Cards.Count;
        Cards.Add(card);
        return(true);
    }