示例#1
0
    public void purchaseCard(PowerCard card)
    {
        Energy e = player.GetComponent <Energy>();

        if (card.getCost() > e.getEnergy())
        {
            Debug.Log("You do not have enough Energy to purchase this card.");
        }
        else
        {
            e.removeEnergy(card.getCost());
            playerHand.Add(card);
            stock.Remove(card);
            if (card.getType().Equals("Discard"))
            {
                card.executeCard();
                playerHand.Remove(card);
            }

            if (deck.Count >= 1)
            {
                stock.Add(deck[0]);
            }
            else
            {
                Debug.Log("The deck is empty!");
            }
        }
    }