Beispiel #1
0
 public void Init()
 {
     if (!AllCards.Any())
     {
         UpdateUserCardsInfo();
     }
 }
Beispiel #2
0
        private void ShuffleCards()
        {
            Player1Cards = new List <Car>();
            Player2Cards = new List <Car>();
            var    cardsPerPlayer = 20;
            var    allCardsTotal  = 40;
            Random random         = new Random();
            var    value          = 0;

            for (int i = 1; i <= cardsPerPlayer; i++)
            {
                do
                {
                    value = random.Next(allCardsTotal);
                }while(!AllCards.Any(obj => obj.Id == value));
                Player1Cards.Add((Car)AllCards.Where(obj => obj.Id == value).FirstOrDefault());
                AllCards.Remove((Car)AllCards.Where(obj => obj.Id == value).FirstOrDefault());
            }
            Player2Cards = AllCards;
        }