Initialize team in Base model with default nil
This commit is contained in:
parent
c1bb6a47de
commit
ffd4e0dfe0
@ -12,7 +12,7 @@ import GameplayKit
|
||||
class Base : GKEntity{
|
||||
var unitCount:Int
|
||||
|
||||
init(team: Team?, position: CGPoint ) {
|
||||
init(position: CGPoint, team: Team! = nil) {
|
||||
self.unitCount = 0
|
||||
super.init()
|
||||
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position))
|
||||
|
@ -27,8 +27,8 @@ class TwoPlayerDefaultTestMap: MapProtocoll {
|
||||
func create() {
|
||||
// Player one (leftest base)
|
||||
let basePlayerOne = Base(
|
||||
team: .team1 ,
|
||||
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2)
|
||||
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2),
|
||||
team: .team1
|
||||
)
|
||||
entityManager.add(basePlayerOne)
|
||||
|
||||
@ -49,13 +49,13 @@ class TwoPlayerDefaultTestMap: MapProtocoll {
|
||||
genericBasePositions.append(CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.75))
|
||||
|
||||
for pos in genericBasePositions {
|
||||
entityManager.add(Base(team: nil, position: pos))
|
||||
entityManager.add(Base(position: pos))
|
||||
}
|
||||
|
||||
// Player two (rightest base)
|
||||
let basePlayerTwo = Base(
|
||||
team: .team2 ,
|
||||
position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2)
|
||||
position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2),
|
||||
team: .team2
|
||||
)
|
||||
entityManager.add(basePlayerTwo)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user