Last active
August 29, 2015 14:06
-
-
Save veeneck/3389f4c5ffad6d562a4e to your computer and use it in GitHub Desktop.
The squad class that holds our units.
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
| import SpriteKit | |
| import Foundation | |
| class Squad : SKNode { | |
| // Handle on all units in the squad. | |
| var units : Array<CharacterNode> = [] | |
| // Current formation technique | |
| var formation : Formation? | |
| required init(coder aDecoder: (NSCoder!)) { | |
| super.init(coder: aDecoder) | |
| } | |
| override init() { | |
| super.init() | |
| // Hard code a formation for this squad. | |
| self.formation = Formation() | |
| } | |
| func addUnit(unit:CharacterNode) { | |
| // Add unit to local array. | |
| self.units.append(unit) | |
| // Add unit to world as a child of this node. | |
| self.addChild(unit) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment