Esempio n. 1
0
    private void DealCard(byte[] memoryBuffer)
    {
        Card card = Card.Deserialize(memoryBuffer);

        //adds the card to the list cards in cardhoolder
        cards.Add(card);
        var behaviour = new GameObject("card_behaviour", typeof(CardBehaviour)).GetComponent<CardBehaviour>();
        behaviour.Card = card;
        behaviour.LoadResource();
        //how many cards are in the list already, match index of new card with cardslot, and set that cardslot as parrent
        behaviour.transform.SetParent(cardslots[cards.Count - 1], true);
        behaviour.transform.localPosition = Vector3.zero;
        behaviour.transform.localRotation = Quaternion.identity;

        if (isCommunity)
            behaviour.FacePlayer();
        //reset transform ( bug avoidance)
        //behaviour.transform.localPosition = Vector3.zero;
        //behaviour.transform.localRotation = Quaternion.identity;
    }