void DealNewDeck(int size) { this.currentDeck.Clear(); for (int i = 0; i < size; i++) { LaundryItem laundryItem = Utility.GetRandomLaundryItem(); this.currentDeck.Add(laundryItem); } }
public static LaundryItem GetRandomLaundryItem() { LaundryItem laundryItem = ScriptableObject.CreateInstance <LaundryItem>(); laundryItem.colorEnum = Utility.GetRandomLaundryColor(); laundryItem.type = Utility.GetRandomLaundryType(); return(laundryItem); }
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); }
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); } }