Beispiel #1
0
    public void DiscardCardAddition()
    {
        if (selectedCard != null)
        {
            //all ally cards activated are added to the board and active allies
            if (selectedCard.type == "Ally Card")
            {
                //ally cards always get added to active allies
                AllyCard ally = (AllyCard)selectedCard;
                players[currentPlayerIndex].activeAllies.Add(ally);
                players[currentPlayerIndex].hand.Remove(selectedCard);
                UIUtil.AddCardToPanel(UIUtil.CreateUIElement(selectedCard, cardPrefab), playerAllyPanels[currentPlayerIndex]);
            }
            else
            {
                bool removed = userInput.CheckDiscardCard(selectedCard);
                if (removed)
                {
                    //add card back to player
                    players[currentPlayerIndex].hand.Add(selectedCard);
                    UIUtil.PopulatePlayerBoard(this);
                }
                else
                {
                    //add it into the panel
                    players[currentPlayerIndex].hand.Remove(selectedCard);

                    //Debug.Log(selectedCard.name);
                    userInput.AddToUIDiscardPanel(UIUtil.CreateUIElement(selectedCard, cardPrefab));
                }
            }

            selectedCard = null;
        }
    }