Exemple #1
0
    public void UpdateCard(Card_SO card)
    {
        if (card)
        {
            if (Name)
            {
                Name.text = card.Name;
            }
            if (Cost)
            {
                Cost.text = card.PuchasePrice.ToString();
            }
            if (Type)
            {
                switch (card.Type)
                {
                case (CardType.Event):
                    Type.text = "Wolf";
                    break;

                case (CardType.Location):
                    Type.text = "Location";
                    break;
                }
            }
            if (Description)
            {
                Description.text = card.Description;
            }
            if (CardArt)
            {
                CardArt.sprite = card.CardArt;
            }
        }
    }
Exemple #2
0
    public CardManager CreateCard(Card_SO cardSO)
    {
        GameObject drawnCard = GameObject.Instantiate(CardPrefab);

        drawnCard.transform.localScale = new Vector3(1, 1, 1);
        CardManager card = drawnCard.GetComponent <CardManager>();

        card.Card = cardSO;
        SetCardPosition(card);
        return(card);
    }
Exemple #3
0
    /// <summary>
    /// Instantiates a card
    /// </summary>
    /// <param name="sO">scriptable object with card data</param>
    /// <param name="pos">position where to instantiate it</param>
    /// <param name="parent">parent gameobject</param>
    /// <param name="num_card">number of card in hand</param>
    /// <returns>Card as a Gameobject</returns>
    private GameObject InstantiateCard(Card_SO sO, Vector3 pos, Transform parent, int num_card)
    {
        cardTempObj = Instantiate(cardPrefab, new Vector3(pos.x + (offset_card * num_card), pos.y - (2 * offset_card), 0), Quaternion.identity, parent);



        cardTempObj.GetComponent <Card>().cardValue = sO.cardValue;
        cardTempObj.GetComponent <Card>().cardColor = sO.cardColor;
        cardTempObj.name = sO.cardValue.ToString() + sO.cardColor.ToString();
        cardTempObj.transform.GetChild(1).GetComponent <Image>().sprite = sO.cardSprite;


        return(cardTempObj);
    }
    public void CardPreview()
    {
        RaycastHit hitOut;
        Card_SO    preview = null;

        if (Utility.ScreenRaycast(out hitOut, CardMask))
        {
            CardManager dc = hitOut.collider.gameObject.GetComponent <CardManager>();
            if (dc)
            {
                preview = dc.Card;
            }
        }
        ThePlayer.PreviewCard = preview;
    }