changes after review
This commit is contained in:
parent
aee6ec1ac1
commit
9ec6a252ee
@ -6,7 +6,6 @@
|
||||
// Copyright © 2020 SP2. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import SpriteKit
|
||||
import GameplayKit
|
||||
|
||||
|
@ -14,11 +14,11 @@ class EndGameState: GKState {
|
||||
let LOG = OSLog.init(subsystem: "EndGameState", category: "EndGameState")
|
||||
|
||||
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)
|
||||
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)
|
||||
return false
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ class GameState: GKState {
|
||||
let LOG = OSLog.init(subsystem: "GameState", category: "GameState")
|
||||
|
||||
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)
|
||||
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)
|
||||
return false
|
||||
}
|
||||
|
@ -14,11 +14,11 @@ class MenuState: GKState {
|
||||
let LOG = OSLog.init(subsystem: "MenuState", category: "MenuState")
|
||||
|
||||
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)
|
||||
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)
|
||||
return false
|
||||
}
|
||||
@ -37,7 +37,7 @@ class MenuState: GKState {
|
||||
|
||||
override func didEnter(from previousState: GKState?) {
|
||||
os_log("Entered Menu State", log: LOG, type: .info)
|
||||
|
||||
// UIApplication.shared.windows[0].rootViewController
|
||||
if (previousState == nil){
|
||||
if let view = StateManager.sharedInstance.gameVC!.view as! SKView? {
|
||||
let scene = MenuScene(size: StateManager.sharedInstance.gameVC!.view.bounds.size)
|
||||
|
@ -15,7 +15,7 @@ class SyncingState: GKState {
|
||||
var previousState: GKState?
|
||||
|
||||
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)
|
||||
return false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user