public GameState() { players = new List <PlayerState>(); deck = UNOCard.Shuffle(UNOCard.GetDeck()); currentCard = deck[0]; deck = UNOCard.RemoveCard(deck, currentCard); }
public UNOCard[] GetCardsFromDeck(int noOfCards) { if (noOfCards < 1) { return(null); } UNOCard[] cards = new UNOCard[noOfCards]; for (int i = 0; i < noOfCards; i++) { cards[i] = deck[0]; deck = UNOCard.RemoveCard(deck, cards[i]); } return(cards); }
public void AddPlayer(PlayerState playerState) { playerState.currentCard = currentCard; playerState.noOfCards = Constants.START_CARDS; UNOCard[] playerCards = new UNOCard[Constants.START_CARDS]; for (int i = 0; i < Constants.START_CARDS; i++) { UNOCard card = deck[0]; playerCards[i] = card; deck = UNOCard.RemoveCard(deck, card); } playerState.playerCards = playerCards; players.Add(playerState); Debug.WriteLine("Player properly added!"); }