From ce2d8473938eb4b0237c3f3f962b248f7a8a6d5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Chauntalle=20Schu=CC=88le?= Date: Fri, 29 May 2020 01:22:55 +0200 Subject: [PATCH] added GameState --- GoldWars/GoldWars.xcodeproj/project.pbxproj | 4 +++ GoldWars/GoldWars/GameState.swift | 29 +++++++++++++++++++++ GoldWars/GoldWars/StateTypes.swift | 16 ------------ 3 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 GoldWars/GoldWars/GameState.swift diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index 22e7c65..6aa558c 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -50,6 +50,7 @@ AE6BB1C224807AC00063ECAE /* StateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1C124807AC00063ECAE /* StateManager.swift */; }; AE6BB1C424807C490063ECAE /* MenuState.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1C324807C490063ECAE /* MenuState.swift */; }; AE6BB1C624807CDA0063ECAE /* SyncingState.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1C524807CDA0063ECAE /* SyncingState.swift */; }; + AE6BB1C824807E6A0063ECAE /* GameState.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1C724807E6A0063ECAE /* GameState.swift */; }; C04783EE2468583F004961FB /* intro-music.mp3 in Resources */ = {isa = PBXBuildFile; fileRef = C04783ED2468583F004961FB /* intro-music.mp3 */; }; C04783F024685995004961FB /* SettingsScene.swift in Sources */ = {isa = PBXBuildFile; fileRef = C04783EF24685995004961FB /* SettingsScene.swift */; }; C05BB9C4247D890C00411249 /* SliderComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = C05BB9C3247D890C00411249 /* SliderComponent.swift */; }; @@ -119,6 +120,7 @@ AE6BB1C124807AC00063ECAE /* StateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateManager.swift; sourceTree = ""; }; AE6BB1C324807C490063ECAE /* MenuState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuState.swift; sourceTree = ""; }; AE6BB1C524807CDA0063ECAE /* SyncingState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SyncingState.swift; sourceTree = ""; }; + AE6BB1C724807E6A0063ECAE /* GameState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameState.swift; sourceTree = ""; }; C04783ED2468583F004961FB /* intro-music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "intro-music.mp3"; sourceTree = ""; }; C04783EF24685995004961FB /* SettingsScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScene.swift; sourceTree = ""; }; C05BB9C3247D890C00411249 /* SliderComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SliderComponent.swift; sourceTree = ""; }; @@ -194,6 +196,7 @@ AE6BB1C124807AC00063ECAE /* StateManager.swift */, AE6BB1C324807C490063ECAE /* MenuState.swift */, AE6BB1C524807CDA0063ECAE /* SyncingState.swift */, + AE6BB1C724807E6A0063ECAE /* GameState.swift */, ); path = GoldWars; sourceTree = ""; @@ -421,6 +424,7 @@ AE6BB1C624807CDA0063ECAE /* SyncingState.swift in Sources */, 9EEDE02D246FCD770096C735 /* SpinningLogoEntity.swift in Sources */, AE6BB1C224807AC00063ECAE /* StateManager.swift in Sources */, + AE6BB1C824807E6A0063ECAE /* GameState.swift in Sources */, 9E174C86245DD91500209FF0 /* ButtonComponent.swift in Sources */, 11036113244B3E30008610AF /* MenuScene.swift in Sources */, C099579C246C5E5C0016AA22 /* DataService.swift in Sources */, diff --git a/GoldWars/GoldWars/GameState.swift b/GoldWars/GoldWars/GameState.swift new file mode 100644 index 0000000..d4bc4a8 --- /dev/null +++ b/GoldWars/GoldWars/GameState.swift @@ -0,0 +1,29 @@ +// +// GameState.swift +// GoldWars +// +// Created by Chauntalle Schüle on 29.05.20. +// Copyright © 2020 SP2. All rights reserved. +// + +import GameKit +import os + +class GameState: GKState { + + let LOG = OSLog.init(subsystem: "GameState", category: "GameState") + + override func isValidNextState(_ stateClass: AnyClass) -> Bool { + return stateClass is SyncingState.Type + } + + override func didEnter(from previousState: GKState?) { + os_log("Entered Game State", log: LOG, type: .info) + } + + override func update(deltaTime seconds: TimeInterval) { + } + + override func willExit(to nextState: GKState) { + } +} diff --git a/GoldWars/GoldWars/StateTypes.swift b/GoldWars/GoldWars/StateTypes.swift index 04d04db..b75bfdc 100644 --- a/GoldWars/GoldWars/StateTypes.swift +++ b/GoldWars/GoldWars/StateTypes.swift @@ -16,22 +16,6 @@ enum StateTypes { case endGameSt } -class GameState: GKState { - let LOG = OSLog.init(subsystem: "GameState", category: "GameState") - - override func isValidNextState(_ stateClass: AnyClass) -> Bool { - return stateClass is SyncingState.Type - } - - override func didEnter(from previousState: GKState?) { - os_log("Entered Game State", log: LOG, type: .info) - } - override func update(deltaTime seconds: TimeInterval) { - } - override func willExit(to nextState: GKState) { - } -} - class EndGameState: GKState { let LOG = OSLog.init(subsystem: "EndGameState", category: "EndGameState")