Esempio n. 1
0
    public void SpawnCard(Card card)
    {
        // check if
        ContainerItem container = HandCardContainers.GetFirstEmptyContainerFromLeft();

        if (container == null)
        {
            Debug.Log("Can't spawn card - no empty containers");
            return;
        }

        var cardObj = HandCardItemPool.GetObject();

        cardObj.transform.localPosition = LocalSpawnPosition;

        HandCardItem cardItem = cardObj.GetComponent <HandCardItem>();

        cardItem.transform.SetParent(container.transform, false);
        cardItem.Initialize(card);

        cardItem.gameObject.SetActive(true);
        cardItem.gameObject.name = "Card " + EnabledHandCards.Items.Count;
    }