add nullable ownerShipPlayer to Base and add init of it to init-method

This commit is contained in:
Jakob Haag 2020-05-09 15:22:24 +02:00
parent 6e7758767f
commit e1b0ac4d87

View File

@ -8,17 +8,20 @@
import SpriteKit
import GameplayKit
import GameKit
class Base: GKEntity {
var unitCount: Int
var adjacencyList: Array<Base>
var changeOwnerShip: Bool
var ownerShipPlayer: GKPlayer?
init(position: CGPoint, team: Team! = nil) {
init(position: CGPoint, player: GKPlayer! = nil, team: Team! = nil) {
self.unitCount = 0
self.adjacencyList = [Base]()
self.changeOwnerShip = false
self.ownerShipPlayer = player
super.init()
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position))