Beispiel #1
0
 public void Deal(Participant participant)
 {
     if (State == GameState.Playing)
     {
         Card card = Instantiate(cardPrefab, participant.Container).GetComponent <Card>();
         card.Set(CardDeck.DrawCard());
         card.transform.position = DeckTransform.position;
         participant.AddCard(card);
     }
 }
Beispiel #2
0
    public void AddCard(Participant participant, uint amount)
    {
        for (int i = 0; i < amount; i++)
        {
            if (availableCards.Count == 0)
            {
                Shuffle();
            }

            if (availableCards.Count != 0)
            {
                int cardIndex = Random.Range(0, availableCards.Count);
                participant.AddCard(availableCards[cardIndex]);

                availableCards.RemoveAt(cardIndex);
            }
            else
            {
                Debug.LogWarning("There is no more card!");
            }
        }
    }