void RpcSetTopCard(GameObject go, ColorCard card, Quaternion angle)
    {
        // Set angle
        go.transform.rotation = angle;

        // Set texture
        CardSpriteLoader ctl = go.GetComponent <CardSpriteLoader>();

        ctl.SetSprite(card.type, card.color, card.value);

        // Save the top card to later check if this play is valid.
        player.SetTopCard(card);
    }
Beispiel #2
0
    /// <summary>
    /// Adds the given card to the card wheel.
    /// </summary>
    /// <param name="card">Card.</param>
    public void AddCard(ColorCard card)
    {
        GameObject newCard = Instantiate(cardPrefab, GetCardPosition(cardUIObjects.Count), Quaternion.Euler(0, 0, -cardUIObjects.Count * CARD_ANGLE_INCREMENT));

        newCard.transform.parent = gameObject.transform;
        CardSpriteLoader ctl = newCard.GetComponent <CardSpriteLoader>();

        ctl.SetSprite(card.type, card.color, card.value);

        cardUIObjects.Add(newCard);
        addedCards.Add(card);
        cardCount++;

        RealingnCards();
    }
    void CmdSpawnCardOnGameboard(ColorCard card)
    {
        // Add random angle here
        Quaternion newAngle = Quaternion.Euler(0, 0, UnityEngine.Random.Range(-10.0f, 10.0f));

        currentCard.transform.rotation = newAngle;
        // Set texture
        CardSpriteLoader ctl = currentCard.GetComponent <CardSpriteLoader>();

        ctl.SetSprite(card.type, card.color, card.value);

        //NetworkServer.Spawn(currentCard); // Spawn on network
        SpawnedCards.Push(card); // Store on server stack
        player.SetTopCard(card);

        // Propagate new card with texture and angle change also to all clients
        RpcSetTopCard(currentCard, card, newAngle);
    }