diff --git a/GoldWars/GoldWars.xcodeproj/project.pbxproj b/GoldWars/GoldWars.xcodeproj/project.pbxproj index e16e8ec..5261a4e 100644 --- a/GoldWars/GoldWars.xcodeproj/project.pbxproj +++ b/GoldWars/GoldWars.xcodeproj/project.pbxproj @@ -44,7 +44,6 @@ 9EEDE02D246FCD770096C735 /* SpinningLogoEntity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */; }; 9EEDE02F246FCD800096C735 /* SpinningLogoComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EEDE02E246FCD800096C735 /* SpinningLogoComponent.swift */; }; AB0B88F6247AD89200C8DF66 /* SkillComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB0B88F5247AD89200C8DF66 /* SkillComponent.swift */; }; - AB1D759D245DD18100671525 /* TwoPlayerDefaultTestMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */; }; AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759F245DEC0500671525 /* MapFactory.swift */; }; AB21D7D5246C748A00B09CBA /* TwoPlayerMapGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */; }; ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; }; @@ -111,7 +110,6 @@ 9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinningLogoEntity.swift; sourceTree = ""; }; 9EEDE02E246FCD800096C735 /* SpinningLogoComponent.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SpinningLogoComponent.swift; sourceTree = ""; }; AB0B88F5247AD89200C8DF66 /* SkillComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SkillComponent.swift; sourceTree = ""; }; - AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TwoPlayerDefaultTestMap.swift; sourceTree = ""; }; AB1D759F245DEC0500671525 /* MapFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapFactory.swift; sourceTree = ""; }; AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoPlayerMapGenerator.swift; sourceTree = ""; }; ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = ""; }; @@ -286,7 +284,6 @@ children = ( 3E67853F24728368007B9DE4 /* CElements.swift */, AB1D759F245DEC0500671525 /* MapFactory.swift */, - AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */, AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */, ); path = Map; @@ -422,7 +419,6 @@ C064E9A8246C0EA50022B228 /* LabelNode.swift in Sources */, 3F745DF0246F48FC00CE7375 /* PlayerMoveType.swift in Sources */, AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */, - AB1D759D245DD18100671525 /* TwoPlayerDefaultTestMap.swift in Sources */, 3E67854024728368007B9DE4 /* CElements.swift in Sources */, ABA03DA0244BD54F00A66916 /* Base.swift in Sources */, C064E9AC246C151F0022B228 /* Label.swift in Sources */, diff --git a/GoldWars/GoldWars/Map/MapFactory.swift b/GoldWars/GoldWars/Map/MapFactory.swift index fd7dc3c..3f28737 100644 --- a/GoldWars/GoldWars/Map/MapFactory.swift +++ b/GoldWars/GoldWars/Map/MapFactory.swift @@ -44,7 +44,7 @@ class MapFactory { self.twoPlayerMapGenerator = TwoPlayerMapGenerator(scene: scene, entityManager: entityManager) } - func loadMap() -> MapGenerationModel{ + func loadMap() -> MapGenerationModel { let mapModel = TwoPlayerMapGenerator.getNewMapModel() loadMap(fromModel: mapModel) return mapModel diff --git a/GoldWars/GoldWars/Map/TwoPlayerDefaultTestMap.swift b/GoldWars/GoldWars/Map/TwoPlayerDefaultTestMap.swift deleted file mode 100644 index 84e4a48..0000000 --- a/GoldWars/GoldWars/Map/TwoPlayerDefaultTestMap.swift +++ /dev/null @@ -1,84 +0,0 @@ -// -// DefaultTestMap.swift -// GoldWars -// -// Created by Marcel Schwarz on 02.05.20. -// Copyright © 2020 SP2. All rights reserved. -// - -import Foundation -import SpriteKit -import GameKit - -class TwoPlayerDefaultTestMap: MapProtocol { - - var entityManager: EntityManager! - var size: CGSize! - - required init(scene: SKScene, entityManager: EntityManager) { - self.entityManager = entityManager; - self.size = scene.size - } - - func load(withModel mapModel: MapGenerationModel) { - - // Create Bases - let basePlayerOne = Base( - position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2), - player: (GameCenterManager.sharedInstance.isServer) ? GKLocalPlayer.local : GameCenterManager.sharedInstance.myMatch?.players[0], - team: .team1 - ) - - let column1 = [ - Base(position: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.25)), - Base(position: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.5)), - Base(position: CGPoint(x: self.size.width * 0.25, y: self.size.height * 0.75)) - ] - - let column2 = [ - Base(position: CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.333)), - Base(position: CGPoint(x: self.size.width * 0.5, y: self.size.height * 0.666)) - ] - - let column3 = [ - Base(position: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.25)), - Base(position: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.5)), - Base(position: CGPoint(x: self.size.width * 0.75, y: self.size.height * 0.75)) - ] - - let basePlayerTwo = Base( - position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2), - player: (!GameCenterManager.sharedInstance.isServer) ? GKLocalPlayer.local : GameCenterManager.sharedInstance.myMatch?.players[0], - team: .team2 - ) - - // Create adjacency Mapping - basePlayerOne.adjacencyList.append(contentsOf: column1) - - column1.forEach({currBase in - currBase.adjacencyList.append(contentsOf: column2) - currBase.adjacencyList.append(basePlayerOne) - }) - - column2.forEach({currBase in - currBase.adjacencyList.append(contentsOf: column3) - currBase.adjacencyList.append(contentsOf: column1) - }) - - column3.forEach({currBase in - currBase.adjacencyList.append(basePlayerTwo) - currBase.adjacencyList.append(contentsOf: column3) - }) - - basePlayerTwo.adjacencyList.append(contentsOf: column3) - - // Register bases with the EntityManager - entityManager.add(basePlayerOne) - - column1.forEach({base in entityManager.add(base)}) - column2.forEach({base in entityManager.add(base)}) - column3.forEach({base in entityManager.add(base)}) - - entityManager.add(basePlayerTwo) - } -}