added MenuState, is initial State

This commit is contained in:
Chauntalle Schüle 2020-05-29 01:11:42 +02:00
parent 3bbae779af
commit d7d17dba2b
3 changed files with 35 additions and 27 deletions

View File

@ -46,6 +46,9 @@
AB21D7D5246C748A00B09CBA /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB21D7D4246C748A00B09CBA /* MapFactory.swift */; };
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; };
ABC0C3732481509300387B8F /* MapUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABC0C3722481509300387B8F /* MapUtils.swift */; };
AE6BB1C0248030720063ECAE /* StateTypes.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1BF248030720063ECAE /* StateTypes.swift */; };
AE6BB1C224807AC00063ECAE /* StateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1C124807AC00063ECAE /* StateManager.swift */; };
AE6BB1C424807C490063ECAE /* MenuState.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE6BB1C324807C490063ECAE /* MenuState.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 */; };
@ -113,6 +116,7 @@
ABC0C3722481509300387B8F /* MapUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapUtils.swift; sourceTree = "<group>"; };
AE6BB1BF248030720063ECAE /* StateTypes.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateTypes.swift; sourceTree = "<group>"; };
AE6BB1C124807AC00063ECAE /* StateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StateManager.swift; sourceTree = "<group>"; };
AE6BB1C324807C490063ECAE /* MenuState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuState.swift; sourceTree = "<group>"; };
C04783ED2468583F004961FB /* intro-music.mp3 */ = {isa = PBXFileReference; lastKnownFileType = audio.mp3; path = "intro-music.mp3"; sourceTree = "<group>"; };
C04783EF24685995004961FB /* SettingsScene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScene.swift; sourceTree = "<group>"; };
C05BB9C3247D890C00411249 /* SliderComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SliderComponent.swift; sourceTree = "<group>"; };
@ -186,6 +190,7 @@
3EAD889424801B6A0048A10A /* RoundTimer.swift */,
AE6BB1BF248030720063ECAE /* StateTypes.swift */,
AE6BB1C124807AC00063ECAE /* StateManager.swift */,
AE6BB1C324807C490063ECAE /* MenuState.swift */,
);
path = GoldWars;
sourceTree = "<group>";
@ -404,6 +409,7 @@
C04783F024685995004961FB /* SettingsScene.swift in Sources */,
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */,
C064E9AA246C114C0022B228 /* LabelComponent.swift in Sources */,
AE6BB1C424807C490063ECAE /* MenuState.swift in Sources */,
3EBD242E245D9332003CECE7 /* Team.swift in Sources */,
9E174C88245DF1FF00209FF0 /* BackgroundComponent.swift in Sources */,
9E78ACBA245CBDAF00526FF7 /* HUD.swift in Sources */,

View File

@ -0,0 +1,29 @@
//
// MenuState.swift
// GoldWars
//
// Created by Chauntalle Schüle on 29.05.20.
// Copyright © 2020 SP2. All rights reserved.
//
import GameKit
import os
class MenuState: GKState {
let LOG = OSLog.init(subsystem: "MenuState", category: "MenuState")
override func isValidNextState(_ stateClass: AnyClass) -> Bool {
return stateClass is SyncingState.Type
}
override func update(deltaTime seconds: TimeInterval) {
}
override func didEnter(from previousState: GKState?) {
os_log("Entered Menu State", log: LOG, type: .info)
}
override func willExit(to nextState: GKState) {
}
}

View File

@ -16,33 +16,6 @@ enum StateTypes {
case endGameSt
}
class MenuState: GKState {
let LOG = OSLog.init(subsystem: "MenuState", category: "MenuState")
override func isValidNextState(_ stateClass: AnyClass) -> Bool {
/* guard GameViewController.allowedState != States.menuSt && GameViewController.allowedState == nil else {
return false
}
if (GameViewController.allowedState == States.syncingSt){
return stateClass is SyncingState.Type
}else {
return false
}*/
return stateClass is SyncingState.Type
}
override func update(deltaTime seconds: TimeInterval) {
}
override func didEnter(from previousState: GKState?) {
os_log("Entered Menu State", log: LOG, type: .info)
}
override func willExit(to nextState: GKState) {
}
}
class SyncingState: GKState {
let LOG = OSLog.init(subsystem: "SyncingState", category: "SyncingState")