diff --git a/GoldWars/GoldWars/GameCenterManager.swift b/GoldWars/GoldWars/GameCenterManager.swift index fbf0c8d..7f07d5c 100644 --- a/GoldWars/GoldWars/GameCenterManager.swift +++ b/GoldWars/GoldWars/GameCenterManager.swift @@ -170,10 +170,12 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG os_log("State 4 erhalten, Peer hat verloren", log: LOG, type: .info) winner = hostingPlayer?.displayName gameEnded = true + (EntityManager.gameEMInstance.scene as! GameScene).gameEnd() case 5: os_log("State 5 erhalten, Peer hat gewonnen", log: LOG, type: .info) winner = peerPlayer?.displayName gameEnded = true + (EntityManager.gameEMInstance.scene as! GameScene).gameEnd() case 6: os_log("State 6 erhalten, Peer hat Spiel verlassen ", log: LOG, type: .info) opponentQuit = true diff --git a/GoldWars/GoldWars/RoundCalculatorService.swift b/GoldWars/GoldWars/RoundCalculatorService.swift index 4aacba7..d146659 100644 --- a/GoldWars/GoldWars/RoundCalculatorService.swift +++ b/GoldWars/GoldWars/RoundCalculatorService.swift @@ -20,7 +20,7 @@ class RoundCalculatorService { let ATK_BOOST_MULTIPLICATOR = 1.1 let DEF_BOOST_MULTIPLICATOR = 1.1 - let MAX_ROUNDS = 20 + let MAX_ROUNDS = 3 var currentRound = 1 var isCalculating = false var numberOfAttacks = 0 @@ -160,7 +160,7 @@ class RoundCalculatorService { winner == GameCenterManager.sharedInstance.hostingPlayer?.displayName ? GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 4)) : GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 5)) GameCenterManager.sharedInstance.winner = winner GameCenterManager.sharedInstance.gameEnded = true - + (EntityManager.gameEMInstance.scene as! GameScene).gameEnd() // Update EloSystem if winner == GameCenterManager.sharedInstance.hostingPlayer?.displayName { EloHelper.updateEloScore(winner: GameCenterManager.sharedInstance.hostingPlayer!, hatDenNikoGemacht: GameCenterManager.sharedInstance.peerPlayer!) diff --git a/GoldWars/GoldWars/Scenes/GameScene.swift b/GoldWars/GoldWars/Scenes/GameScene.swift index 93d4548..762e25e 100644 --- a/GoldWars/GoldWars/Scenes/GameScene.swift +++ b/GoldWars/GoldWars/Scenes/GameScene.swift @@ -78,12 +78,7 @@ class GameScene: SKScene{ override func update(_ currentTime: TimeInterval) { entityManager.getBackground()?.update(deltaTime: currentTime) - if GameCenterManager.sharedInstance.gameEnded && !gameEndEffects { - gameEnd() - } - if GameCenterManager.sharedInstance.quitGame { - gameQuit() - } + }