Example #1
0
    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);
    }
Example #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();
    }
Example #3
0
 private void Awake()
 {
     spriteLoader         = new CardSpriteLoader();
     handModifierAnalyzer = new HandModifierAnalyzer();
     extraCardAnalyzer    = new ExtraCardAnalyzer();
     spriteLoader.LoadSpritesForCards(cardData.cards, OnLoadFinished);
     CodeControl.Message.AddListener <CardGrabbedEvent>(OnCardGrabbed);
     CodeControl.Message.AddListener <CardsConsumeRequestEvent>(OnCardsConsumeRequested);
     CodeControl.Message.AddListener <CardDroppedEvent>(OnCardDropped);
     CodeControl.Message.AddListener <DrawRandomCardsRequestEvent>(OnDrawRandomCardsRequested);
     CodeControl.Message.AddListener <CardPickRequestEvent>(OnCardPickRequested);
     CodeControl.Message.AddListener <CardPickStartRequestEvent>(OnCardPickStartRequested);
     CodeControl.Message.AddListener <ConfirmCardsPickedRequestEvent>(OnPickedCardsConfirmed);
     CodeControl.Message.AddListener <CardSellProcessBeginRequestEvent>(OnCardSellProcessBeginRequested);
     CodeControl.Message.AddListener <DeckPickedEvent>(OnDeckPicked);
 }
Example #4
0
    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);
    }