public IEnumerator AssignPunishmentCard_GivesPlayerANewPunishmentCard() { //Tests if AssignPunishmentCard adds a card to a player's punishment card list. Setup(); //Get player1's current punishment card list Player player1 = players [0]; List <Card> player1Cards = new List <Card>(player1.GetPunishmentCards()); //Copy the current punishment card list cardDeck.AssignPunishmentCard(player1); //Assign a card to player1 Assert.AreNotEqual(player1Cards, player1.GetPunishmentCards()); //Has the list changed? Assert.AreEqual(player1Cards.Count + 1, player1.GetPunishmentCards().Count); //Has exactly 1 card been added? Assert.IsNotNull(player1.GetPunishmentCards() [0]); //Is the element a valid card (i.e. not null)? yield return(null); }
public void NextPlayer() { // set the current player to the next player in the order // deactivate the current player currentPlayer.SetActive(false); currentPlayer.GetGui().Deactivate(); // find the index of the current player for (int i = 0; i < players.Length; i++) { if (players[i] == currentPlayer) { // set the next player's index int nextPlayerIndex = i + 1; // if end of player list is reached, loop back to the first player if (nextPlayerIndex == players.Length) { currentPlayer = players[0]; players[0].SetActive(true); players[0].GetGui().Activate(); } // otherwise, set the next player as the current player else { currentPlayer = players[nextPlayerIndex]; players[nextPlayerIndex].SetActive(true); players[nextPlayerIndex].GetGui().Activate(); break; } } } //ASSESSMENT4 ADDITION ------------------------------ // Check if any of the active cards need to be deactivated and deactivate them cardDeck.DeactivatePunishmentCards(currentPlayer); cardDeck.AssignPunishmentCard(currentPlayer); //--------------------------------------------------- }