import GameKit, format Code and change method to getBasesByPlayer

This commit is contained in:
Jakob Haag 2020-05-15 11:59:05 +02:00
parent 8b87dc59ad
commit 5eb8267266

View File

@ -8,6 +8,7 @@
import SpriteKit
import GameplayKit
import GameKit
class GameScene: SKScene{
@ -46,12 +47,14 @@ class GameScene: SKScene{
if !(entityManager.getTeamByBase(base: currentDraggedBase!) == entityManager.getTeamByBase(base: base)){
entityManager.add(Modal(modaltype: .BaseAttack,
base: currentDraggedBase!,
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2), entityManager: entityManager, gameScene: self))
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
entityManager: entityManager, gameScene: self))
entityManager.update((currentDraggedBase?.attackBase(base: base, units: 100))!)
}else {
entityManager.add(Modal(modaltype: .BaseAttack,
base: currentDraggedBase!,
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2), entityManager: entityManager, gameScene: self))
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
entityManager: entityManager, gameScene: self))
}
}
@ -71,7 +74,8 @@ class GameScene: SKScene{
}
entityManager.add(Modal(modaltype: .BaseDetails,
base: entity as! Base,
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2), entityManager: entityManager, gameScene: self))
anchorPoint: CGPoint(x: self.size.width / 2 , y: self.size.height / 2),
entityManager: entityManager, gameScene: self))
}
}
}
@ -96,7 +100,7 @@ class GameScene: SKScene{
body.text = "Schicke \( ((e.component(ofType: SliderComponent.self)?.sliderNode.getValue ?? 0) * CGFloat((e as! Modal).unitCount)).rounded(.up)) Einheiten "
} }
let bases = entityManager.getBasesByTeam(for: .team1)
let bases = entityManager.getBasesByPlayer(for: GKLocalPlayer.local)
for base in bases {
if atPoint(touchLocation) == base.component(ofType: DefaultBaseComponent.self)?.spriteNode{