public RecipieKind DoesRecipieExistByIngredients(Dictionary <IngredientKind, int> ing) { for (int i = 0; i < recipieConfigs.Count; i++) { RecipieConfig recipie = recipieConfigs[i]; //IN EACH RECIPIE bool contains = true; for (var z = 0; z < recipie.reqirements.Count; z++) { //EACH RECIPIE REQUIREMENT RecipieRequirements r = recipie.reqirements[z]; if (!ing.ContainsKey(r.ingredient)) { contains = false; } else if (ing[r.ingredient] < r.count) { contains = false; } } if (contains) { return(recipie.kind); } } return(RecipieKind.None); }
public void Sync(LevelTask task) { blockFail.SetActive(false); blockWin.SetActive(false); startTime = task.time; time = task.time; id = task.id; rewardText.text = task.rewardPoints.ToString(); if (task.taskKind != TaskKind.None) { taskImage.sprite = The.tasks.GetTaskByKind(task.taskKind).icon; } else { taskImage.sprite = The.gameGui.recipieIcon; RecipieConfig c = The.recipies.GetRecipie(task.recipieKind); foreach (RecipieRequirements r in c.reqirements) { RecipieItemPanel p = Instantiate(recipieItem, Vector3.zero, Quaternion.identity); p.transform.parent = recipieIemWrap.transform; p.transform.localScale = Vector3.one; p.count.text = r.count.ToString(); p.icon.sprite = The.ingredients.GetIngredientConfig(r.ingredient).icon; } } progWidth = progressBar.rect.width; progHeight = progressBar.rect.height; active = true; }