Last active
August 29, 2015 14:12
-
-
Save veeneck/a5f2dd16bf11843141cd to your computer and use it in GitHub Desktop.
Cache enumerateChildNodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /// If cache is established | |
| if self.updateListeners.count > 0 { | |
| for listener in self.updateListeners { | |
| listener(currentTime) | |
| } | |
| } | |
| /// Rebuild the cache | |
| else { | |
| self.layers[WorldLayer.World.rawValue].enumerateChildNodesWithName("Character") { | |
| node, stop in | |
| let realNode = node as CharacterNode | |
| /// Call update on the node, and then add the update function to the cache | |
| realNode.updateWithTime(currentTime) | |
| self.updateListeners.append(realNode.updateWithTime) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment