Esempio n. 1
0
    void SetLabels(Recipe targetRecipe, Recipe actualRecipe, Glass glass)
    {
        drinkWasCorrect = false;
        if (actualRecipe == null)
        {
            // No drink could not be found matching
            //titleLabel.text = "You made a custom drink!";
            if (targetRecipe != null)
            {
                //titleLabel.text += " Your customer is not impressed.";
                CustomerNotImpressed();
            }
        }
        else
        {
            float score = Mathf.Ceil(recipes.ClosenessToRecipe(actualRecipe, glass));
            if (targetRecipe == null)
            {
                // No target; so no backlash
                //titleLabel.text = "You made a " + actualRecipe.name + "!";
                //titleLabel.text += " Your accuracy was " + score + "%";
                drinkWasCorrect = true;
                customerManager.OnDrinkServed(score);
            }
            else
            {
                if (targetRecipe == actualRecipe)
                {
                    // Recipe matches what player was supposed to make
                    //titleLabel.text = "You made a " + actualRecipe.name + " in " + gameHandler.GetTargetCompletionTime() + " seconds!";
                    //titleLabel.text += " Your accuracy was " + score + "%";
                    drinkWasCorrect = true;
                    customerManager.OnDrinkServed(score);
                }
                else
                {
                    // Recipe does not match target
                    //titleLabel.text = "You made a " + actualRecipe.name + "! Your customer is not impressed.";
                    CustomerNotImpressed();
                }
            }
        }

        ingredientsLabel.text = "";
        foreach (KeyValuePair <string, float> content in glass.Contents)
        {
            ingredientsLabel.text += content.Key + ": " + (content.Value * glass.maxFillMeasurement).ToString("F2") + "ml\n";
        }
    }