void GiveCardToHand(List <Card> deck, Transform hand) // взять новую карту
    {
        if (deck.Count == 0)
        {
            return;
        }

        Card card = deck[0];

        GameObject cardGO = Instantiate(CardPref, hand, false);

        if (hand == EnemyHand)
        {
            cardGO.GetComponent <CardInfoScript>().HideCardInfo(card);//скрытие руки соперника
            EnemyHandCards.Add(cardGO.GetComponent <CardInfoScript>());
        }
        else
        {
            cardGO.GetComponent <CardInfoScript>().ShowCardInfo(card, true);
            PlayerHandCards.Add(cardGO.GetComponent <CardInfoScript>());
            cardGO.GetComponent <AttackedCardScript>().enabled = false;
        }

        deck.RemoveAt(0);
    }
Esempio n. 2
0
    void GiveCardToHand(List <Card> deck, Transform hand)
    {
        if (deck.Count == 0)
        {
            return;
        }

        Card card = deck[0];

        GameObject cardGO = Instantiate(CardPref, hand, false);

        if (hand == EnemyHand)
        {
            cardGO.GetComponent <CardGiven>().HideCardInfo(card);
            EnemyHandCards.Add(cardGO.GetComponent <CardGiven>());
        }
        else
        {
            a            += 150;
            previewInGame = Instantiate(preview, new Vector3(a, b, c), transform.rotation = Quaternion.identity);
            previewInGame.transform.SetParent(GameObject.FindGameObjectWithTag("Canvas").transform, true);
            previewInGame.GetComponent <Image>().sprite = card.Logo;
            Destroy(previewInGame, 3f);
            cardGO.GetComponent <CardGiven>().ShowCardInfo(card);
            PlayerHandCards.Add(cardGO.GetComponent <CardGiven>());
        }
        deck.RemoveAt(0);
    }
Esempio n. 3
0
    void GiveCardToHand(List <Card> deck, Transform hand)
    {
        if (deck.Count == 0)
        {
            return;
        }

        Card card = deck[0];

        GameObject cardGO = Instantiate(CardPref, hand, false);

        if (hand == EnemyHand)
        {
            cardGO.GetComponent <CardInfoScr>().HideCardInfo(card);
            EnemyHandCards.Add(cardGO.GetComponent <CardInfoScr>());
        }
        else
        {
            cardGO.GetComponent <CardInfoScr>().ShowCardInfo(card, true);
            PlayerHandCards.Add(cardGO.GetComponent <CardInfoScr>());
            cardGO.GetComponent <AttackCard>().enabled = false;
        }


        deck.RemoveAt(0);
    }
    void CreateCardPref(Card card, Transform hand)
    {
        GameObject     cardGO = Instantiate(CardPref, hand, false);
        CardController cardC  = cardGO.GetComponent <CardController>();

        cardC.Init(card, hand == PlayerHand);

        if (cardC.IsPlayerCard)
        {
            PlayerHandCards.Add(cardC);
        }
        else
        {
            EnemyHandCards.Add(cardC);
        }
    }