示例#1
0
    void PowerOff()
    {
        Recipe_v2 r = GetOrderRecipe();

        onOMPowerOff.Invoke(r);

        ResetMachine();
    }
示例#2
0
    Recipe_v2 GetOrderRecipe()
    {
        OrderSlot_v2 slot  = GetComponentInChildren <OrderSlot_v2>();
        Order_v2     order = slot.order;
        Recipe_v2    r     = order.recipe.GetComponent <Recipe_v2>();

        return(r);
    }
示例#3
0
    void PowerOn()
    {
        LED.gameObject.GetComponent <MeshRenderer>().material = LEDOn;
        poweredOn = true;

        Recipe_v2 r = GetOrderRecipe();

        onOMPowerOn.Invoke(r);
    }
示例#4
0
    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();
    }
示例#5
0
    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);
    }
示例#6
0
    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);
    }
示例#7
0
 void TurnOffDisplay(Recipe_v2 r)
 {
     ClearDisplay();
 }
示例#8
0
 void PlayPowerOff(Recipe_v2 r)
 {
     audioSrc.PlayOneShot(powerOffClip);
 }
示例#9
0
 void InitAssembly(Recipe_v2 r)
 {
     currentIngredient = null;
 }