create gameEnd Trigger
This commit is contained in:
parent
dc3ef818df
commit
b29111cb9e
@ -44,6 +44,8 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
|
||||
var entityManager = EntityManager.gameEMInstance
|
||||
var localPlayerRandomNumber: RandomNumber?
|
||||
var initIsFinish = false
|
||||
var gameEnded = false
|
||||
var winner:String?
|
||||
var gameScene: GameScene?
|
||||
static var isAuthenticated: Bool {
|
||||
return GKLocalPlayer.local.isAuthenticated
|
||||
@ -225,10 +227,12 @@ final class GameCenterManager: NSObject, GKMatchmakerViewControllerDelegate, GKG
|
||||
os_log("Spiel startet", log: LOG, type: .info)
|
||||
case 4:
|
||||
os_log("State 4 erhalten, Peer hat verloren", log: LOG, type: .info)
|
||||
// TODO: Trigger Loser Scene
|
||||
winner = hostingPlayer?.displayName
|
||||
gameEnded = true
|
||||
case 5:
|
||||
os_log("State 5 erhalten, Peer hat gewonnen", log: LOG, type: .info)
|
||||
// TODO: Trigger Winner Scene
|
||||
winner = peerPlayer?.displayName
|
||||
gameEnded = true
|
||||
default:
|
||||
break
|
||||
}
|
||||
|
@ -158,7 +158,8 @@ class RoundCalculatorService {
|
||||
winner = determineWinner(by: "capture")
|
||||
}
|
||||
winner == GameCenterManager.sharedInstance.hostingPlayer?.displayName ? GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 4)) : GameCenterManager.sharedInstance.sendStateToPeers(state: State(state: 5))
|
||||
//TODO: Trigger Winner/Loser-Scene for Server
|
||||
GameCenterManager.sharedInstance.winner = winner
|
||||
GameCenterManager.sharedInstance.gameEnded = true
|
||||
return
|
||||
}
|
||||
currentRound += 1
|
||||
|
Loading…
Reference in New Issue
Block a user