Example #1
0
    public static void PlayCard(Card card, int playedBy, RemoteNetworkPlayer networkPlayer)
    {
        destinationPosition = Cards[playedCardCount].position;
        destinationRotation = Cards[playedCardCount].rotation;

        GameObject newCardObject = Instantiate(cardPrefab, playerPositions[playedBy].position, cardPrefab.transform.rotation) as GameObject;

        newCardObject.transform.parent = playedCardsTransform;
        UICard cardScript = newCardObject.transform.GetComponent <UICard>();

        newCardObject.transform.GetComponent <SpriteRenderer>().sortingOrder = 8;

        cardScript.BindCard(card);
        Cards[playedCardCount] = newCardObject.transform;
        playedCardCount++;
        cardToPlay  = card;
        cardPlayer2 = networkPlayer;
        moveCard2   = true;

        UIDeck deck = GameObject.FindGameObjectWithTag("DECK").GetComponent <UIDeck>();

        deck.playedCard = cardScript;

        SoundManagerInstance.PlayCardPlaySound();
    }
Example #2
0
    public void BindCards(Deck deck)
    {
        var cards = deck.GetCards();

        for (int i = 0; i < cards.Count; i++)
        {
            GameObject newCardObject = Instantiate(cardPrefab, cardSlotsInitial[i].CardObject.transform.position, transform.rotation) as GameObject;
            if (cardSlots[i] != null)
            {
                Destroy(cardSlots[i].CardObject);
            }

            cardSlots[i]      = new CardSlot(newCardObject);
            cardSlots[i].Card = cards[i];

            newCardObject.transform.parent   = this.transform;
            newCardObject.transform.position = cardSlotsInitial[i].CardObject.transform.position;
            SpriteRenderer newSpriteRenderer = newCardObject.GetComponent <SpriteRenderer>();
            if (i < 7)
            {
                newSpriteRenderer.sortingOrder = i + 8;
            }
            else
            {
                newSpriteRenderer.sortingOrder = i - 5;
            }
            UICard newCard = newCardObject.GetComponent <UICard>();
            newCard.BindCard(cards[i]);
        }
    }
Example #3
0
    public static void PlayCard(Card card, int playedBy, UIComputer playerComputer)
    {
        destinationPosition = Cards[playedCardCount].position;
        destinationRotation = Cards[playedCardCount].rotation;

        GameObject newCardObject = Instantiate(cardPrefab, playerPositions[playedBy].position, cardPrefab.transform.rotation) as GameObject;

        newCardObject.transform.parent = playedCardsTransform;
        UICard cardScript = newCardObject.transform.GetComponent <UICard>();

        newCardObject.transform.GetComponent <SpriteRenderer>().sortingOrder = 8;

        cardScript.BindCard(card);
        Cards[playedCardCount] = newCardObject.transform;
        playedCardCount++;
        cardToPlay = card;
        cardPlayer = playerComputer;
        moveCard   = true;

        SoundManagerInstance.PlayCardPlaySound();
    }