Example #1
0
 void EnemyRandomlyDrawCards(int drawAmount)
 {
     //Enemy Randomly Draw 4 card. so he lives in 3rd round
     for (int i = 0; Hand.enemyHand.Count < drawAmount; i++)
     {
         //I cant draw cards from my deck if there are none.
         if (enemyDeck.Keys.Count > 0)
         {
             int cardindex = Random.Range(enemyDeck.Keys.Min(), enemyDeck.Keys.Max());
             //Add distinct list of card indexes to draw
             if (enemyDeck.ContainsKey(cardindex))
             {
                 //Add that card to our hand
                 Hand.enemyHand.Add(cardindex, enemyDeck[cardindex]);
                 ArenaManager.totalEnemyCardsInHand = Hand.enemyHand.Count;
                 MyArena.AddEnemyPoints(enemyDeck[cardindex].type.ToString(), enemyDeck[cardindex].points);
                 //And Remove that card so we dont draw it again.
                 enemyDeck.Remove(cardindex);
                 ArenaManager.totalEnemyCardsInDeck = enemyDeck.Count;
             }
         }
         else
         {
             //We can't draw anymore cards, exit the loop
             break;
         }
     }
 }