void PowerOff() { Recipe_v2 r = GetOrderRecipe(); onOMPowerOff.Invoke(r); ResetMachine(); }
Recipe_v2 GetOrderRecipe() { OrderSlot_v2 slot = GetComponentInChildren <OrderSlot_v2>(); Order_v2 order = slot.order; Recipe_v2 r = order.recipe.GetComponent <Recipe_v2>(); return(r); }
void PowerOn() { LED.gameObject.GetComponent <MeshRenderer>().material = LEDOn; poweredOn = true; Recipe_v2 r = GetOrderRecipe(); onOMPowerOn.Invoke(r); }
void TurnOnDisplay(Recipe_v2 r) { display.gameObject.SetActive(true); // FIXME: the prefab instancing each time the order machine powers on can be avoided for performance reasons by caching // the last recipe shown, so to check whether the new recipe is the same as the current one, and if so use the already instanced prefab Transform disRecipe = GameObject.Instantiate(r.disassembledPrefab, recipePos.position, recipePos.rotation); disRecipe.parent = recipePos; recipeName.text = r.recipeName; recipeNameAlt.text = r.recipeName.ToUpper(); }
ScoreData EvaluateRecipe() { List <string> recipeIngs = new List <string>(ABController.currentIngredients); Recipe_v2 r = GetOrderRecipe(); Debug.Log("Recipe placed ingrs: [" + string.Join(",", recipeIngs.ToArray()) + "]"); Debug.Log("Recipe correct ings [" + string.Join(",", r.ingredients.ToArray()) + "]"); ScoreData score = ScoreManager_v2.instance.ProcessScore(recipeIngs, r); Debug.Log("Well done! Your " + r.name + " gave you " + score.finalScore + " points"); return(score); }
public ScoreData ProcessScore(List <string> ings, Recipe_v2 r) { List <string> recipeIngs = new List <string>(r.ingredients); ScoreData score = CalculateScore(ings, recipeIngs); if (score.finalScore < 0) { score.finalScore = 0; } UpdateAndNotify(score); return(score); }
void TurnOffDisplay(Recipe_v2 r) { ClearDisplay(); }
void PlayPowerOff(Recipe_v2 r) { audioSrc.PlayOneShot(powerOffClip); }
void InitAssembly(Recipe_v2 r) { currentIngredient = null; }