コード例 #1
0
    public void itemCollected(string itemName)
    {
        if (ingredientsDict.ContainsKey(itemName))
        {
            ingredientsDict[itemName] = true;

            //display ingredients & state
            string ing = IngredientsToText();
            recipeController = uiRecipe.GetComponent <UIRecipeController>();
            GetComponent <AudioSource>().Play();
            recipeController.ChangeText(ing);

            //check if all ingredients are collected
            bool collectedAllFlag = true;
            foreach (KeyValuePair <string, bool> entry in ingredientsDict)
            {
                if (entry.Value == false)
                {
                    collectedAllFlag = false;
                }
            }

            if (collectedAllFlag)
            {
                allIngredientsCollected = true;
                showEndLevelMessage();
            }
        }
    }
コード例 #2
0
 void Awake()
 {
     recipeController = uiRecipe.GetComponent <UIRecipeController>();
 }