IEnumerator AIPlayCards() { while (!game.gameOver) { if (myHand.cards.Count > 0) { CardBehaviour playcard = myHand.cards[Mathf.RoundToInt(Random.Range(0, myHand.cards.Count))]; playcard.transform.position = new Vector2(Random.Range(playbounds[0], playbounds[1]), Random.Range(playbounds[2], playbounds[3])); yield return(new WaitForSeconds(0.5f)); playcard.AIPlayCard(playcard.transform.position); playcard.DiscardCardAI(); } yield return(new WaitForSeconds(Random.Range(minWait, maxWait))); } }