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