public void UpdateElement() { DishId.text = dishRecipe.Id.ToString(); int[] tempRestaurantCollection = new int[Restaurant.instance.ItemCounts.Length]; Restaurant.instance.ItemCounts.CopyTo(tempRestaurantCollection, 0); //Debug.Log ("DishRecipe " + dishRecipe.Id + " is calling current collection"); int[] currentCollection = dishRecipe.CurrentCollection(); int count = 0; for (int i = 0; i < currentCollection.Length; i++) { if (tempRestaurantCollection[currentCollection[i]] > 0) { ItemBackgrounds [i].color = Color.green; count++; tempRestaurantCollection [currentCollection [i]]--; } else { ItemBackgrounds [i].color = Color.white; } Items [i].text = Restaurant.instance.ItemNames[currentCollection [i]]; } UpButton.SetActive(count >= currentCollection.Length && dishRecipe.Level < dishRecipe.MaxLevel); SetStars(); }
public void LevelUpDish(DishRecipe dishRecipe) { int[] currentCollection = dishRecipe.CurrentCollection(); foreach (var item in currentCollection) { ItemCounts [item]--; } dishRecipe.LevelUp(); OnRestaurantInfoChanged(); }