added info that you're once again entering the same state you're already in

This commit is contained in:
Chauntalle Schüle 2020-05-31 22:01:51 +02:00
parent 0492ab7724
commit 3ea48c399e

View File

@ -20,6 +20,7 @@ class StateManager{
var menuSc: MenuScene? var menuSc: MenuScene?
var gameVC: GameViewController? var gameVC: GameViewController?
var gameSc: GameScene?
let LOG = OSLog.init(subsystem: "StateManager", category: "StateManager") let LOG = OSLog.init(subsystem: "StateManager", category: "StateManager")
@ -29,24 +30,36 @@ class StateManager{
switch wantedState { switch wantedState {
case .menuSt: case .menuSt:
if stateMachine?.enter(MenuState.self) == false { if stateMachine?.enter(MenuState.self) == false {
if previousState is MenuState{
os_log("Already in Menu State", log: LOG, type: .info)
}
os_log("Failed entering Menu State", log: LOG, type: .info) os_log("Failed entering Menu State", log: LOG, type: .info)
}else{ }else{
currentState = stateMachine?.currentState currentState = stateMachine?.currentState
} }
case .gameSt: case .gameSt:
if stateMachine?.enter(GameState.self) == false { if stateMachine?.enter(GameState.self) == false {
if previousState is GameState{
os_log("Already in Game State", log: LOG, type: .info)
}
os_log("Failed entering Game State", log: LOG, type: .info) os_log("Failed entering Game State", log: LOG, type: .info)
}else{ }else{
currentState = stateMachine?.currentState currentState = stateMachine?.currentState
} }
case .syncingSt: case .syncingSt:
if stateMachine?.enter(SyncingState.self) == false { if stateMachine?.enter(SyncingState.self) == false {
if previousState is SyncingState{
os_log("Already in Syncing State", log: LOG, type: .info)
}
os_log("Failed entering Syncing State", log: LOG, type: .info) os_log("Failed entering Syncing State", log: LOG, type: .info)
}else{ }else{
currentState = stateMachine?.currentState currentState = stateMachine?.currentState
} }
case .endGameSt: case .endGameSt:
if stateMachine?.enter(EndGameState.self) == false { if stateMachine?.enter(EndGameState.self) == false {
if previousState is EndGameState{
os_log("Already in EndGame State", log: LOG, type: .info)
}
os_log("Failed entering EndGame State", log: LOG, type: .info) os_log("Failed entering EndGame State", log: LOG, type: .info)
}else{ }else{
currentState = stateMachine?.currentState currentState = stateMachine?.currentState