Noob here, slowly learning.
I’m having trouble working out how to compare a tag to an int variable. The tags on certain cards are “0”, “1”, & “2”.
My cardCount variable resets every 3 cards. I would like to execute a method if the cardCount and the tag align.
Apologies if this is super basic.
Thanks in advance.
public List<Card> deck = new List<Card>();
public int cardCount = 0;
public void DrawCard()
{
if (deck.Count >= 1)
{
if (cardCount <= 2)
{
Card randCard = deck[Random.Range(0, deck.Count)];
**if (randCard.CompareTag.(cardCount))**
{
Debug.Log("game over");
}
randCard.gameObject.SetActive(true);
deck.Remove(randCard);
cardCount++;
}
else
cardCount = 1;
,Noob here, slowly learning.
I’m having trouble working out how to compare a tag to an int variable. The tags one certain cards are “0”, “1”, & “2”.
My cardCount variable resets every 3 cards. I would like to execute a method if the cardCount and the tag align.
Apologies if this is super basic.
Thanks in advance.
public List<Card> deck = new List<Card>();
public int cardCount = 0;
public void DrawCard()
{
if (deck.Count >= 1)
{
if (cardCount <= 2)
{
Card randCard = deck[Random.Range(0, deck.Count)];
**if (randCard.CompareTag.(cardCount))**
{
Debug.Log("game over");
}
randCard.gameObject.SetActive(true);
deck.Remove(randCard);
cardCount++;
}
else
cardCount = 1;