我有一组带有配料的按钮,另一组带有配料但可以使用的工具,并且我想在选择正确的工具和与其对应的配料时给出要点。
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
}
}
}
}
请帮助我 谢谢