From 5eb8267266333ad950ed57256d25fee28f31a6c1 Mon Sep 17 00:00:00 2001 From: Jakob Haag Date: Fri, 15 May 2020 11:59:05 +0200 Subject: [PATCH] import GameKit, format Code and change method to getBasesByPlayer --- GoldWars/GoldWars/Scenes/GameScene.swift | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/GoldWars/GoldWars/Scenes/GameScene.swift b/GoldWars/GoldWars/Scenes/GameScene.swift index bb47730..dae1566 100644 --- a/GoldWars/GoldWars/Scenes/GameScene.swift +++ b/GoldWars/GoldWars/Scenes/GameScene.swift @@ -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{