Trying to do something I feel like should be simple but nothing I've tried so far works. I'm trying to prevent this loop from continuing until a property on my enemy is set to true.
My enemy node figures out a path to the player during the walk state. I don't want to iterate to the next enemy until the path has been calculated. My enemy node has a pathComplete node I set to true during the walk state.
This is executed on touch.
for node:AnyObject in self.children {
if node is EnemyNode {
let enemy = node as! EnemyNode
enemy.destination = coordinate
enemy.stateMachine.enterState(WalkingState)
}
}