void StartProcessing(IngredientMix ing, SpriteRenderer renderer) { processingTarget = ing; processingRender = renderer; renderer.enabled = false; currentState = PROCESSING; progressBar.gameObject.SetActive(true); }
public void MixIngredients() { IngredientMix result = Instantiate(MixPrefab, IngredientParent); result.transform.position = transform.position + new Vector3(1, 0, 0); Color averageColor = new Color(0, 0, 0); foreach (var ingredientMix in ingredientsHeld) { averageColor += ingredientMix.PowderColor; foreach (var ingredient in ingredientMix.Ingredients) { result.Ingredients.Add(ingredient); } } result.SetColor(averageColor / ingredientsHeld.Count); foreach (var bottle in bottlesHeld) { foreach (var ingredient in result.Ingredients) { for (int i = 0; i < ingredient.Attributes.Count; i++) { if (bottle.Intensity > i) { ingredient.Attributes[i].Unlocked = true; } } } } for (int i = bottlesHeld.Count - 1; i >= 0; i--) { Destroy(bottlesHeld[i].gameObject); } for (int i = ingredientsHeld.Count - 1; i >= 0; i--) { Destroy(ingredientsHeld[i].gameObject); } bottlesHeld.Clear(); ingredientsHeld.Clear(); circleMover.ClearTransforms(); }
private bool TryGetMix(int ingredient1Id, int ingredient2Id, int mood, IEnumerable <IngredientMix> mixes, out IngredientMix mix) { mix = mixes.FirstOrDefault(o => o.Ingredient1 == ingredient1Id && o.Ingredient2 == ingredient2Id && (o.Mood == null || o.MoodType == mood)); if (mix != null) { return(true); } return(false); }