示例#1
0
    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();
        }
    }