I have a set of buttons with ingredients and another set of the same but with the tools that can be used, and I want to give points when the correct tool and the ingredient that corresponds to it are selected.
gameViewController:
func givePoints () {
let toolSelected = MainInfoManager.shared.getToolWith(name: ToolName(rawValue: toolSelectedId)!)
let ingredientSelected = MainInfoManager.shared.getIngredientWith(name: IngredientName(rawValue: ingredientSelectedId)!)
if let currentBowl = bowl, seconds > 0 {
print("funciono")
for ingredient in currentBowl.ingredients {
print ("este tambien")
if ingredient.id == ingredientSelected.id && toolSelected.ingredients.contains(where: { $0.id == ingredientSelected.id }) {
print("y este tambien")
pointsForChoices += 10
}
}
}
}
please help me thank you
Aucun commentaire:
Enregistrer un commentaire