public TileItem GetNewItem() { // TODO: WHOOPS. The cooldowns should be on items....not colors. List <TileItem> currrentlyPossibleItems = new List <TileItem>(possibleItems); List <TileItem> currrentlyPossibleItems2 = new List <TileItem>(possibleItems); if (colorCooldowns.Count == currrentlyPossibleItems.Count) { pointSystem.IncreaseMultiplier(); colorCooldowns.Clear(); } List <ColorPalette> colorCooldownColors = new List <ColorPalette>(colorCooldowns.Keys); foreach (ColorPalette color in colorCooldownColors) { foreach (TileItem item in currrentlyPossibleItems2) { if (item.itemColor == color) { currrentlyPossibleItems.Remove(item); } } } TileItem returnItem; if (currrentlyPossibleItems.Count < 1) { returnItem = possibleItems[Random.Range(0, possibleItems.Length)]; } else { returnItem = currrentlyPossibleItems[Random.Range(0, currrentlyPossibleItems.Count)]; } return(returnItem); }