Exemplo n.º 1
0
 void Awake()
 {
     instance = this;
     SummoningManager = GetComponent<SummoningManager>();
     TooltipController = GetComponent<TooltipController>();
     MissionControll = GetComponent<MissionControll>();
 }
Exemplo n.º 2
0
 void Awake()
 {
     missionControll = GameManager.instance.MissionControll;
 }
Exemplo n.º 3
0
    void Awake()
    {
        for (int i = 0; i < allDemons.Length; i++)
        {
            allDemons[i].demonId = i;
            allDemons[i].hasSummoned = false;
        }

        missionControll = GameManager.instance.MissionControll;

        for (int i = 0; i < allTypes.Count; i++)
        {
            GameObject obj = Instantiate(allTypes[i].gameObject);
            ItemType type = obj.GetComponent<ItemType>();
            type.ID = i;
            allTypes[i] = type;
        }

        for (int i = 0; i < allIngredients.Count; i ++)
        {
            if (!allIngredients[i]) continue;

            GameObject obj = Instantiate(allIngredients[i].gameObject);
            Ingredient ing = obj.GetComponent<Ingredient>();
            allIngredients[i] = ing;
        }

        foreach (var ingredient in allIngredients)
        {
            if (!ingredient) continue;

            foreach (var type in allTypes)
            {
//                if (ingredient == null) print("ing == null");
//                if (ingredient.typeTier == null) print("ing.typetier == null");
//                if (ingredient.typeTier.type == null) print("ing.typetier.type == null");
//                if (type == null) print("type == null");

                if (ingredient.typeTier.type.typeName == type.typeName)
                {
                    ingredient.typeTier.type = type;
                }
            }
        }

        for (int i = 0; i < allRecipes.Count; i++)
        {
            GameObject obj = Instantiate(allRecipes[i].gameObject);
            Recipe recipe = obj.GetComponent<Recipe>();

            for (int j = 0; j < recipe.ingredients.Count; j++) 
            {
                foreach (var ingred in allIngredients)
                {
                    if (!ingred) continue;

                    if (recipe.ingredients[j].ingredientName == ingred.ingredientName)
                    {
                        recipe.ingredients[j] = ingred;
                    }
                }
            }

            allRecipes[i] = recipe;
        }
    }