Skip to content

Commit

Permalink
🔀 Merge branch 'hugo/feature/Add-overlay-on-wrong-DnD-answers'
Browse files Browse the repository at this point in the history
  • Loading branch information
ladislas committed Nov 3, 2023
2 parents c1a412f + 59cadd2 commit 19210f3
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ class DragAndDropBaseScene: SKScene {
group.notify(queue: .main) {
self.onDropAction(node)
}
disableWrongAnswer(node)
}

func onDragAnimation(_ node: SKSpriteNode) {
Expand All @@ -193,6 +194,14 @@ class DragAndDropBaseScene: SKScene {
selectedNodes = [:]
}

private func disableWrongAnswer(_ node: DraggableImageAnswerNode) {
let gameplayChoiceModel = viewModel.choices.first(where: { $0.choice.value == node.name })!
if gameplayChoiceModel.choice.dropZone == nil {
node.colorBlendFactor = 0.4
node.isDraggable = false
}
}

override func didMove(to view: SKView) {
self.reset()
}
Expand Down

0 comments on commit 19210f3

Please sign in to comment.