public bool HardRecipeCheck(IngredientMixer mixer) { var ingredients = CurrentRecipe.PrepareInstructions.IngredientsList; var measures = CurrentRecipe.PrepareInstructions.MeasuresList; int correctSteps = 0; if (mixer.NumberOfTypes() != ingredients.Count) { if (GameManager.Instance.SoundFXOn) { source.Play(); } CurrentRecipe.Shake(); return(false); } for (int i = 0; i < mixer.NumberOfTypes(); i++) { if (mixer.UsedIngredients[i].Name == ingredients[i]) { if (mixer.Measures[i] == measures[i]) { correctSteps++; } else { if (GameManager.Instance.SoundFXOn) { source.Play(); } CurrentRecipe.Shake(); return(false); } } else { if (GameManager.Instance.SoundFXOn) { source.Play(); } CurrentRecipe.Shake(); return(false); } } return(correctSteps == ingredients.Count); }
public bool NormalCheckRecipe(IngredientMixer mixer) { var steps = CurrentRecipe.PrepareSteps; int correctSteps = 0; if (mixer.NumberOfTypes() != steps.Count) { if (GameManager.Instance.SoundFXOn) { source.Play(); } CurrentRecipe.Shake(); return(false); } for (int i = 0; i < mixer.NumberOfTypes(); i++) { if (steps.ContainsKey(mixer.UsedIngredients[i].Name)) { var measure = mixer.Measures[i]; if (measure == steps[mixer.UsedIngredients[i].Name]) { correctSteps++; } else { correctSteps = correctSteps <= 0 ? 0 : correctSteps - 1; CurrentRecipe.Shake(); if (GameManager.Instance.SoundFXOn) { source.Play(); } } } else { correctSteps = correctSteps <= 0 ? 0 : correctSteps - 1; CurrentRecipe.Shake(); if (GameManager.Instance.SoundFXOn) { source.Play(); } } } return(correctSteps == steps.Count); }