public void GiveSipsToSelectedPlayer() { var actionPair = GiveActionPlayers.Last(); var dropDown = GivePanel.GetComponentInChildren <Dropdown>(); var intPlayerVal = dropDown.value; var targetPlayer = Players[intPlayerVal]; var removedCard = actionPair.Card; // remove the card from the active player actionPair.Player.Hand = actionPair.Player.Hand.Where(c => c.Suit != removedCard.Suit || c.Value != removedCard.Value).ToList(); // give the card to the targeted player targetPlayer.Hand.Add(removedCard); DispenseSips(targetPlayer, actionPair.Sips, false); // remove the card action from the list GiveActionPlayers.RemoveAt(GiveActionPlayers.Count - 1); if (GiveActionPlayers.Count == 0) { GivePanel.SetActive(false); } else { // set next player action SetActionPair(); } }
private void SetActionPair() { // set current player CurrentPlayerIndex = Players.IndexOf(GiveActionPlayers.Last().Player); // Set counter GiveCounter.text = GiveActionPlayers.Where(pair => pair.Player == CurrentPlayer).Count() + ""; // set name SetActivePlayer(); }