changes after review

This commit is contained in:
Chauntalle Schüle 2020-06-02 23:04:21 +02:00
parent aee6ec1ac1
commit 9ec6a252ee
5 changed files with 8 additions and 9 deletions

View File

@ -6,7 +6,6 @@
// Copyright © 2020 SP2. All rights reserved. // Copyright © 2020 SP2. All rights reserved.
// //
import UIKit
import SpriteKit import SpriteKit
import GameplayKit import GameplayKit

View File

@ -14,11 +14,11 @@ class EndGameState: GKState {
let LOG = OSLog.init(subsystem: "EndGameState", category: "EndGameState") let LOG = OSLog.init(subsystem: "EndGameState", category: "EndGameState")
override func isValidNextState(_ stateClass: AnyClass) -> Bool { override func isValidNextState(_ stateClass: AnyClass) -> Bool {
if StateManager.sharedInstance.stateMachine?.currentState is EndGameState && stateClass is EndGameState.Type{ if stateMachine?.currentState is EndGameState && stateClass is EndGameState.Type {
os_log("Already in EndGame State", log: LOG, type: .info) os_log("Already in EndGame State", log: LOG, type: .info)
return false return false
} }
if stateClass is SyncingState.Type || stateClass is GameState.Type{ if stateClass is SyncingState.Type || stateClass is GameState.Type {
os_log("Failed: Entering SyncingState and GameState after EndGameState is not allowed", log: LOG, type: .info) os_log("Failed: Entering SyncingState and GameState after EndGameState is not allowed", log: LOG, type: .info)
return false return false
} }

View File

@ -14,11 +14,11 @@ class GameState: GKState {
let LOG = OSLog.init(subsystem: "GameState", category: "GameState") let LOG = OSLog.init(subsystem: "GameState", category: "GameState")
override func isValidNextState(_ stateClass: AnyClass) -> Bool { override func isValidNextState(_ stateClass: AnyClass) -> Bool {
if StateManager.sharedInstance.stateMachine?.currentState is GameState && stateClass is GameState.Type{ if stateMachine?.currentState is GameState && stateClass is GameState.Type {
os_log("Already in Game State", log: LOG, type: .info) os_log("Already in Game State", log: LOG, type: .info)
return false return false
} }
if stateClass is MenuState.Type || stateClass is EndGameState.Type{ if stateClass is MenuState.Type || stateClass is EndGameState.Type {
os_log("Failed: Entering MenuState and EndgameState after GameState is not allowed", log: LOG, type: .info) os_log("Failed: Entering MenuState and EndgameState after GameState is not allowed", log: LOG, type: .info)
return false return false
} }

View File

@ -14,11 +14,11 @@ class MenuState: GKState {
let LOG = OSLog.init(subsystem: "MenuState", category: "MenuState") let LOG = OSLog.init(subsystem: "MenuState", category: "MenuState")
override func isValidNextState(_ stateClass: AnyClass) -> Bool { override func isValidNextState(_ stateClass: AnyClass) -> Bool {
if StateManager.sharedInstance.stateMachine?.currentState is MenuState && stateClass is MenuState.Type{ if stateMachine?.currentState is MenuState && stateClass is MenuState.Type {
os_log("Already in Menu State", log: LOG, type: .info) os_log("Already in Menu State", log: LOG, type: .info)
return false return false
} }
if stateClass is EndGameState.Type{ if stateClass is EndGameState.Type {
os_log("Entering EndGameState after MenuState is not allowed", log: LOG, type: .info) os_log("Entering EndGameState after MenuState is not allowed", log: LOG, type: .info)
return false return false
} }
@ -37,7 +37,7 @@ class MenuState: GKState {
override func didEnter(from previousState: GKState?) { override func didEnter(from previousState: GKState?) {
os_log("Entered Menu State", log: LOG, type: .info) os_log("Entered Menu State", log: LOG, type: .info)
// UIApplication.shared.windows[0].rootViewController
if (previousState == nil){ if (previousState == nil){
if let view = StateManager.sharedInstance.gameVC!.view as! SKView? { if let view = StateManager.sharedInstance.gameVC!.view as! SKView? {
let scene = MenuScene(size: StateManager.sharedInstance.gameVC!.view.bounds.size) let scene = MenuScene(size: StateManager.sharedInstance.gameVC!.view.bounds.size)

View File

@ -15,7 +15,7 @@ class SyncingState: GKState {
var previousState: GKState? var previousState: GKState?
override func isValidNextState(_ stateClass: AnyClass) -> Bool { override func isValidNextState(_ stateClass: AnyClass) -> Bool {
if StateManager.sharedInstance.stateMachine?.currentState is SyncingState && stateClass is SyncingState.Type{ if stateMachine?.currentState is SyncingState && stateClass is SyncingState.Type {
os_log("Already in Syncing State", log: LOG, type: .info) os_log("Already in Syncing State", log: LOG, type: .info)
return false return false
} }