Ejemplo n.º 1
0
    private void CmdPlayerPlaysCard(int cardID, bool playedByHost)
    {
        CardDefinition card = CardDefinition.GetCardDefinitionWithID(cardID);

        if (ServerSidePlayCard(card, playedByHost))
        {
            RpcPlayerSuccessfullyPlaysCard(cardID, playedByHost);
        }
    }
Ejemplo n.º 2
0
    public Library(int[] arrayOfCardDefIDs)
    {
        cards = new List <Card>();

        for (int i = 0; i < arrayOfCardDefIDs.Length; i++)
        {
            CardDefinition definition = CardDefinition.GetCardDefinitionWithID(arrayOfCardDefIDs[i]);

            if (definition == null)
            {
                Debug.LogError("Can't finish constructing library. Given array to construct contains invalud IDs.");
                continue;
            }
            else
            {
                Card instance = definition.GetCardInstance();
                cards.Add(instance);
            }
        }
    }
Ejemplo n.º 3
0
    //add some number of a card to the deck
    public void AddCard(int cardID, int numberToAdd = 1)
    {
        if (numberToAdd <= 0)
        {
            Debug.LogError("Tried to put a 0/negative number of a single card into the deck.");
            return;
        }

        int maxCopiesOfCard = CardDefinition.GetCardDefinitionWithID(cardID).MaxCopiesInDeck;

        if (deck.ContainsKey(cardID))
        {
            if ((deck[cardID] + numberToAdd) > maxCopiesOfCard)
            {
                Debug.LogError("Putting " + numberToAdd + " cards in would make the current number " + deck[cardID].ToString() + " go over the limit for that card: " + maxCopiesOfCard.ToString());
                return;
            }
            else
            {
                deck[cardID] += numberToAdd;
                cardCount    += numberToAdd;
            }
        }
        else
        {
            if (numberToAdd > maxCopiesOfCard)
            {
                Debug.LogError("Putting " + numberToAdd + " cards in would go over the limit for that card: " + maxCopiesOfCard.ToString());
                return;
            }
            else
            {
                deck.Add(cardID, numberToAdd);
                cardCount += numberToAdd;
            }
        }
    }
Ejemplo n.º 4
0
    private void RpcPlayerSuccessfullyPlaysCard(int cardID, bool playedByHost)
    {
        CardDefinition card = CardDefinition.GetCardDefinitionWithID(cardID);

        NetworkedGameManager.SingletonGameManager.PlayerStatusChanged();
    }