void ReplaceAndDestroyCards() { for (int i = 0; i < listOfVec3.Count; i++) { Debug.Log("I AM WORKING"); if (deck.cards.Count != 0) { Debug.Log("I am inside"); deckFill = GameObject.FindGameObjectWithTag("Deck"); deck = deckFill.GetComponent <Dekk>(); int n = Random.Range(0, deck.cards.Count); GameObject g = Instantiate(deck.cards[n], listOfVec3[i], Quaternion.identity) as GameObject; g.transform.parent = gameObject.transform; deck.cards.Remove(deck.cards[n]); Debug.Log("I am inside"); } Debug.Log("I AM WORKING TOO"); Destroy(listOfTargetsToDestroy[i]); } listOfTargetsToDestroy.Clear(); listOfVec3.Clear(); legitCombination = false; Debug.Log("legit is going false"); }
void OptimalScore() { deck = GetComponent <Dekk>(); indexes = deckFill.GetComponentsInChildren <CardInformation>(); foreach (CardInformation card in indexes) { if (legitCombination == true) { listOfAllIndexes.Clear(); } else if (deck.amountsOfCards != listOfAllIndexes.Count) { int n = card.cardIndex; listOfAllIndexes.Add(n); RepeatingIndexes(n); } } }