diff --git a/GoldWars/GoldWars/States/StateManager.swift b/GoldWars/GoldWars/States/StateManager.swift index eb4c66c..8afc73b 100644 --- a/GoldWars/GoldWars/States/StateManager.swift +++ b/GoldWars/GoldWars/States/StateManager.swift @@ -20,6 +20,7 @@ class StateManager{ var menuSc: MenuScene? var gameVC: GameViewController? + var gameSc: GameScene? let LOG = OSLog.init(subsystem: "StateManager", category: "StateManager") @@ -29,24 +30,36 @@ class StateManager{ switch wantedState { case .menuSt: 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) }else{ currentState = stateMachine?.currentState } case .gameSt: 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) }else{ currentState = stateMachine?.currentState } case .syncingSt: 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) }else{ currentState = stateMachine?.currentState } case .endGameSt: 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) }else{ currentState = stateMachine?.currentState