示例#1
0
    //When card is selected (Used in CardSelect)
    public void CardPick(int current)
    {
        foreach (int key in keyList)
        {
            if (key == current)
            {
                effects.PlayCard(hand[key]);
                //Debug.Log(hand[key]);

                if (effects.played)
                {
                    //print(hand[key]);
                    effects.SetCardID(hand[key] - 10);
                    effects.TimeStop(hand[key] - 10);
                    //print(unusedCards.Peek());
                    if (unusedCards.Count <= 0)
                    {
                        int[] shuffleMe = new int[discardPile.Count];
                        int   iteration = discardPile.Count;
                        for (int i = 0; i < iteration; i++)
                        {
                            shuffleMe[i] = discardPile.Dequeue();
                        }
                        Shuffle(shuffleMe);
                        for (int i = 0; i < shuffleMe.Length; i++)
                        {
                            unusedCards.Enqueue(shuffleMe[i]);
                        }
                    }
                    discardPile.Enqueue(hand[key]);
                    hand[key] = (int)unusedCards.Dequeue();
                }

                break;
            }
        }
    }