예제 #1
0
 void DealNewDeck(int size)
 {
     this.currentDeck.Clear();
     for (int i = 0; i < size; i++)
     {
         LaundryItem laundryItem = Utility.GetRandomLaundryItem();
         this.currentDeck.Add(laundryItem);
     }
 }
예제 #2
0
    public static LaundryItem GetRandomLaundryItem()
    {
        LaundryItem laundryItem = ScriptableObject.CreateInstance <LaundryItem>();

        laundryItem.colorEnum = Utility.GetRandomLaundryColor();
        laundryItem.type      = Utility.GetRandomLaundryType();

        return(laundryItem);
    }
예제 #3
0
    public LaundryItem RequestLaundryItemFromDeck()
    {
        if (this.currentDeck.Count == 0)
        {
            throw new InvalidOperationException("Deck is empty");
        }

        int         popIndex    = 0;
        LaundryItem returnValue = this.currentDeck[popIndex];

        this.currentDeck.RemoveAt(popIndex);
        return(returnValue);
    }
예제 #4
0
    public void Deal()
    {
        IEnumerable <HandSlot> emptyHandSlots = GetEmptyHandSlots();

        foreach (HandSlot slot in emptyHandSlots)
        {
            if (GameManager._instance.IsDeckEmpty())
            {
                // Stop dealing if the deck is now empty
                break;
            }

            LaundryItem dealtItem = GameManager._instance.RequestLaundryItemFromDeck();
            dealtItem.CreateInstance(slot.transform);
        }
    }