Add CElements and Ways
This commit is contained in:
parent
53705849f2
commit
4fdd95bd76
@ -18,6 +18,9 @@
|
|||||||
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116060F6245C57D2004E5A36 /* EntityManager.swift */; };
|
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 116060F6245C57D2004E5A36 /* EntityManager.swift */; };
|
||||||
11738A3B24508F68004426F1 /* Unit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11738A3A24508F68004426F1 /* Unit.swift */; };
|
11738A3B24508F68004426F1 /* Unit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 11738A3A24508F68004426F1 /* Unit.swift */; };
|
||||||
2086465C2461B66200817C23 /* TimerComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2086465B2461B66200817C23 /* TimerComponent.swift */; };
|
2086465C2461B66200817C23 /* TimerComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2086465B2461B66200817C23 /* TimerComponent.swift */; };
|
||||||
|
3E67854024728368007B9DE4 /* CElemente.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E67853F24728368007B9DE4 /* CElemente.swift */; };
|
||||||
|
3E6785422472CBEC007B9DE4 /* Way.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6785412472CBEC007B9DE4 /* Way.swift */; };
|
||||||
|
3E6785442472CC27007B9DE4 /* DefaultWayComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E6785432472CC27007B9DE4 /* DefaultWayComponent.swift */; };
|
||||||
3EBD242C245D8044003CECE7 /* GameCenterHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EBD242B245D8044003CECE7 /* GameCenterHelper.swift */; };
|
3EBD242C245D8044003CECE7 /* GameCenterHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EBD242B245D8044003CECE7 /* GameCenterHelper.swift */; };
|
||||||
3EBD242E245D9332003CECE7 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EBD242D245D9332003CECE7 /* Team.swift */; };
|
3EBD242E245D9332003CECE7 /* Team.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EBD242D245D9332003CECE7 /* Team.swift */; };
|
||||||
3F745DF0246F48FC00CE7375 /* PlayerMoveType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F745DEF246F48FC00CE7375 /* PlayerMoveType.swift */; };
|
3F745DF0246F48FC00CE7375 /* PlayerMoveType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3F745DEF246F48FC00CE7375 /* PlayerMoveType.swift */; };
|
||||||
@ -49,7 +52,6 @@
|
|||||||
AB1D759D245DD18100671525 /* TwoPlayerDefaultTestMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */; };
|
AB1D759D245DD18100671525 /* TwoPlayerDefaultTestMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */; };
|
||||||
AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759F245DEC0500671525 /* MapFactory.swift */; };
|
AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB1D759F245DEC0500671525 /* MapFactory.swift */; };
|
||||||
AB21D7D5246C748A00B09CBA /* TwoPlayerMapGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */; };
|
AB21D7D5246C748A00B09CBA /* TwoPlayerMapGenerator.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */; };
|
||||||
AB94038A2471528D004FCD07 /* SampleCElement.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB9403892471528D004FCD07 /* SampleCElement.swift */; };
|
|
||||||
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; };
|
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = ABA03D9F244BD54F00A66916 /* Base.swift */; };
|
||||||
AE151589245F18EF001D363E /* MatchmakingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE151588245F18EF001D363E /* MatchmakingHelper.swift */; };
|
AE151589245F18EF001D363E /* MatchmakingHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = AE151588245F18EF001D363E /* MatchmakingHelper.swift */; };
|
||||||
AEBF3AFF246EB146004F7CD5 /* CancelBtnNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEBF3AFE246EB146004F7CD5 /* CancelBtnNode.swift */; };
|
AEBF3AFF246EB146004F7CD5 /* CancelBtnNode.swift in Sources */ = {isa = PBXBuildFile; fileRef = AEBF3AFE246EB146004F7CD5 /* CancelBtnNode.swift */; };
|
||||||
@ -89,6 +91,9 @@
|
|||||||
116060F6245C57D2004E5A36 /* EntityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityManager.swift; sourceTree = "<group>"; };
|
116060F6245C57D2004E5A36 /* EntityManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EntityManager.swift; sourceTree = "<group>"; };
|
||||||
11738A3A24508F68004426F1 /* Unit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Unit.swift; sourceTree = "<group>"; };
|
11738A3A24508F68004426F1 /* Unit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Unit.swift; sourceTree = "<group>"; };
|
||||||
2086465B2461B66200817C23 /* TimerComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerComponent.swift; sourceTree = "<group>"; };
|
2086465B2461B66200817C23 /* TimerComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TimerComponent.swift; sourceTree = "<group>"; };
|
||||||
|
3E67853F24728368007B9DE4 /* CElemente.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CElemente.swift; sourceTree = "<group>"; };
|
||||||
|
3E6785412472CBEC007B9DE4 /* Way.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Way.swift; sourceTree = "<group>"; };
|
||||||
|
3E6785432472CC27007B9DE4 /* DefaultWayComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DefaultWayComponent.swift; sourceTree = "<group>"; };
|
||||||
3EBD242B245D8044003CECE7 /* GameCenterHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameCenterHelper.swift; sourceTree = "<group>"; };
|
3EBD242B245D8044003CECE7 /* GameCenterHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GameCenterHelper.swift; sourceTree = "<group>"; };
|
||||||
3EBD242D245D9332003CECE7 /* Team.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Team.swift; sourceTree = "<group>"; };
|
3EBD242D245D9332003CECE7 /* Team.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Team.swift; sourceTree = "<group>"; };
|
||||||
3F745DEF246F48FC00CE7375 /* PlayerMoveType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerMoveType.swift; sourceTree = "<group>"; };
|
3F745DEF246F48FC00CE7375 /* PlayerMoveType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PlayerMoveType.swift; sourceTree = "<group>"; };
|
||||||
@ -121,7 +126,6 @@
|
|||||||
AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TwoPlayerDefaultTestMap.swift; sourceTree = "<group>"; };
|
AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TwoPlayerDefaultTestMap.swift; sourceTree = "<group>"; };
|
||||||
AB1D759F245DEC0500671525 /* MapFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapFactory.swift; sourceTree = "<group>"; };
|
AB1D759F245DEC0500671525 /* MapFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MapFactory.swift; sourceTree = "<group>"; };
|
||||||
AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoPlayerMapGenerator.swift; sourceTree = "<group>"; };
|
AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoPlayerMapGenerator.swift; sourceTree = "<group>"; };
|
||||||
AB9403892471528D004FCD07 /* SampleCElement.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SampleCElement.swift; sourceTree = "<group>"; };
|
|
||||||
ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = "<group>"; };
|
ABA03D9F244BD54F00A66916 /* Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Base.swift; sourceTree = "<group>"; };
|
||||||
AE151588245F18EF001D363E /* MatchmakingHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchmakingHelper.swift; sourceTree = "<group>"; };
|
AE151588245F18EF001D363E /* MatchmakingHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MatchmakingHelper.swift; sourceTree = "<group>"; };
|
||||||
AEBF3AFE246EB146004F7CD5 /* CancelBtnNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CancelBtnNode.swift; sourceTree = "<group>"; };
|
AEBF3AFE246EB146004F7CD5 /* CancelBtnNode.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CancelBtnNode.swift; sourceTree = "<group>"; };
|
||||||
@ -233,6 +237,7 @@
|
|||||||
2086465B2461B66200817C23 /* TimerComponent.swift */,
|
2086465B2461B66200817C23 /* TimerComponent.swift */,
|
||||||
9EBFD7542462CF5A00E1E219 /* SliderComponent.swift */,
|
9EBFD7542462CF5A00E1E219 /* SliderComponent.swift */,
|
||||||
9EC7E48A2461FBF700396BCD /* SliderNode.swift */,
|
9EC7E48A2461FBF700396BCD /* SliderNode.swift */,
|
||||||
|
3E6785432472CC27007B9DE4 /* DefaultWayComponent.swift */,
|
||||||
);
|
);
|
||||||
path = Components;
|
path = Components;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -240,13 +245,14 @@
|
|||||||
116060F5245C5709004E5A36 /* Entities */ = {
|
116060F5245C5709004E5A36 /* Entities */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */,
|
9E174C89245E1A0A00209FF0 /* Background.swift */,
|
||||||
ABA03D9F244BD54F00A66916 /* Base.swift */,
|
ABA03D9F244BD54F00A66916 /* Base.swift */,
|
||||||
9EC86B9E245C88A300796EF3 /* Modal.swift */,
|
9E174C83245DD8CE00209FF0 /* Button.swift */,
|
||||||
116060F6245C57D2004E5A36 /* EntityManager.swift */,
|
116060F6245C57D2004E5A36 /* EntityManager.swift */,
|
||||||
9E78ACB9245CBDAF00526FF7 /* HUD.swift */,
|
9E78ACB9245CBDAF00526FF7 /* HUD.swift */,
|
||||||
9E174C83245DD8CE00209FF0 /* Button.swift */,
|
9EC86B9E245C88A300796EF3 /* Modal.swift */,
|
||||||
9E174C89245E1A0A00209FF0 /* Background.swift */,
|
9EEDE02C246FCD770096C735 /* SpinningLogoEntity.swift */,
|
||||||
|
3E6785412472CBEC007B9DE4 /* Way.swift */,
|
||||||
);
|
);
|
||||||
path = Entities;
|
path = Entities;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -299,10 +305,10 @@
|
|||||||
AB1D759E245DD2EA00671525 /* Map */ = {
|
AB1D759E245DD2EA00671525 /* Map */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
3E67853F24728368007B9DE4 /* CElemente.swift */,
|
||||||
AB1D759F245DEC0500671525 /* MapFactory.swift */,
|
AB1D759F245DEC0500671525 /* MapFactory.swift */,
|
||||||
AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */,
|
AB1D759B245DD18100671525 /* TwoPlayerDefaultTestMap.swift */,
|
||||||
AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */,
|
AB21D7D4246C748A00B09CBA /* TwoPlayerMapGenerator.swift */,
|
||||||
AB9403892471528D004FCD07 /* SampleCElement.swift */,
|
|
||||||
);
|
);
|
||||||
path = Map;
|
path = Map;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -419,6 +425,7 @@
|
|||||||
9E78ACC4245CCA3600526FF7 /* SpySkillComponent.swift in Sources */,
|
9E78ACC4245CCA3600526FF7 /* SpySkillComponent.swift in Sources */,
|
||||||
9EA3ABEB245C6DFA006BC61D /* BaseNode.swift in Sources */,
|
9EA3ABEB245C6DFA006BC61D /* BaseNode.swift in Sources */,
|
||||||
9E04AFAF245E2B73002D5CFC /* AttackActionComponent.swift in Sources */,
|
9E04AFAF245E2B73002D5CFC /* AttackActionComponent.swift in Sources */,
|
||||||
|
3E6785422472CBEC007B9DE4 /* Way.swift in Sources */,
|
||||||
110360D9244B101A008610AF /* GameScene.swift in Sources */,
|
110360D9244B101A008610AF /* GameScene.swift in Sources */,
|
||||||
C04783F024685995004961FB /* SettingsScene.swift in Sources */,
|
C04783F024685995004961FB /* SettingsScene.swift in Sources */,
|
||||||
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */,
|
116060F7245C57D2004E5A36 /* EntityManager.swift in Sources */,
|
||||||
@ -444,6 +451,7 @@
|
|||||||
AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */,
|
AB1D75A0245DEC0500671525 /* MapFactory.swift in Sources */,
|
||||||
AB1D759D245DD18100671525 /* TwoPlayerDefaultTestMap.swift in Sources */,
|
AB1D759D245DD18100671525 /* TwoPlayerDefaultTestMap.swift in Sources */,
|
||||||
9EBFD7552462CF5A00E1E219 /* SliderComponent.swift in Sources */,
|
9EBFD7552462CF5A00E1E219 /* SliderComponent.swift in Sources */,
|
||||||
|
3E67854024728368007B9DE4 /* CElemente.swift in Sources */,
|
||||||
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */,
|
ABA03DA0244BD54F00A66916 /* Base.swift in Sources */,
|
||||||
C064E9AC246C151F0022B228 /* Label.swift in Sources */,
|
C064E9AC246C151F0022B228 /* Label.swift in Sources */,
|
||||||
9E174C82245DD81D00209FF0 /* ButtonNode.swift in Sources */,
|
9E174C82245DD81D00209FF0 /* ButtonNode.swift in Sources */,
|
||||||
@ -452,12 +460,12 @@
|
|||||||
9E174C84245DD8CE00209FF0 /* Button.swift in Sources */,
|
9E174C84245DD8CE00209FF0 /* Button.swift in Sources */,
|
||||||
AEBF3AFF246EB146004F7CD5 /* CancelBtnNode.swift in Sources */,
|
AEBF3AFF246EB146004F7CD5 /* CancelBtnNode.swift in Sources */,
|
||||||
110360DB244B101A008610AF /* GameViewController.swift in Sources */,
|
110360DB244B101A008610AF /* GameViewController.swift in Sources */,
|
||||||
|
3E6785442472CC27007B9DE4 /* DefaultWayComponent.swift in Sources */,
|
||||||
2086465C2461B66200817C23 /* TimerComponent.swift in Sources */,
|
2086465C2461B66200817C23 /* TimerComponent.swift in Sources */,
|
||||||
110360D3244B101A008610AF /* AppDelegate.swift in Sources */,
|
110360D3244B101A008610AF /* AppDelegate.swift in Sources */,
|
||||||
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */,
|
9EC86B9F245C88A300796EF3 /* Modal.swift in Sources */,
|
||||||
9E78ACC2245CC9EE00526FF7 /* DefBoostSkillComponent.swift in Sources */,
|
9E78ACC2245CC9EE00526FF7 /* DefBoostSkillComponent.swift in Sources */,
|
||||||
C05FAED62468559D0006AF2E /* SoundManager.swift in Sources */,
|
C05FAED62468559D0006AF2E /* SoundManager.swift in Sources */,
|
||||||
AB94038A2471528D004FCD07 /* SampleCElement.swift in Sources */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
28
GoldWars/GoldWars/Components/DefaultWayComponent.swift
Normal file
28
GoldWars/GoldWars/Components/DefaultWayComponent.swift
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
//
|
||||||
|
// DefaultWayComponent.swift
|
||||||
|
// GoldWars
|
||||||
|
//
|
||||||
|
// Created by Jakob Haag on 18.05.20.
|
||||||
|
// Copyright © 2020 SP2. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import GameplayKit
|
||||||
|
import SpriteKit
|
||||||
|
|
||||||
|
class DefaultWayComponent: GKComponent {
|
||||||
|
var shapeNode: SKShapeNode
|
||||||
|
|
||||||
|
init(pathToDraw: CGMutablePath) {
|
||||||
|
self.shapeNode = SKShapeNode()
|
||||||
|
shapeNode.path = pathToDraw
|
||||||
|
shapeNode.strokeColor = UIColor(red: 0.852, green: 0.649, blue: 0.123, alpha: 1)
|
||||||
|
shapeNode.lineWidth = 10
|
||||||
|
shapeNode.zPosition = -1
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
}
|
25
GoldWars/GoldWars/Components/WayNode.swift
Normal file
25
GoldWars/GoldWars/Components/WayNode.swift
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// WayNode.swift
|
||||||
|
// GoldWars
|
||||||
|
//
|
||||||
|
// Created by Jakob Haag on 18.05.20.
|
||||||
|
// Copyright © 2020 SP2. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import SpriteKit
|
||||||
|
|
||||||
|
class WayNode: SKSpriteNode{
|
||||||
|
|
||||||
|
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
|
print("touched Way")
|
||||||
|
// TODO: PopUp Einheiten + Close PopUp
|
||||||
|
}
|
||||||
|
|
||||||
|
override func touchesMoved(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
|
// TODO: zeige Angirff Effect
|
||||||
|
}
|
||||||
|
|
||||||
|
override func touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
|
||||||
|
// TODO: Open Slider PopUp
|
||||||
|
}
|
||||||
|
}
|
@ -17,6 +17,7 @@ class Base: GKEntity{
|
|||||||
var changeOwnership: Bool
|
var changeOwnership: Bool
|
||||||
var ownershipPlayer: GKPlayer?
|
var ownershipPlayer: GKPlayer?
|
||||||
var baseID: Int
|
var baseID: Int
|
||||||
|
var position: CGPoint
|
||||||
|
|
||||||
init(position: CGPoint, player: GKPlayer! = nil, team: Team! = nil) {
|
init(position: CGPoint, player: GKPlayer! = nil, team: Team! = nil) {
|
||||||
self.unitCount = 0
|
self.unitCount = 0
|
||||||
@ -25,6 +26,7 @@ class Base: GKEntity{
|
|||||||
self.ownershipPlayer = player
|
self.ownershipPlayer = player
|
||||||
self.baseID = Base.BASE_ID_COUNT
|
self.baseID = Base.BASE_ID_COUNT
|
||||||
Base.BASE_ID_COUNT += 1
|
Base.BASE_ID_COUNT += 1
|
||||||
|
self.position = position
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position))
|
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position))
|
||||||
|
@ -82,6 +82,9 @@ class EntityManager {
|
|||||||
if let node = entity.component(ofType: SpinningLogoComponent.self)?.node {
|
if let node = entity.component(ofType: SpinningLogoComponent.self)?.node {
|
||||||
scene.addChild(node)
|
scene.addChild(node)
|
||||||
}
|
}
|
||||||
|
if let wayNode = entity.component(ofType: DefaultWayComponent.self)?.shapeNode {
|
||||||
|
scene.addChild(wayNode)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func remove(_ entity: GKEntity) {
|
func remove(_ entity: GKEntity) {
|
||||||
|
30
GoldWars/GoldWars/Entities/Way.swift
Normal file
30
GoldWars/GoldWars/Entities/Way.swift
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
//
|
||||||
|
// Way.swift
|
||||||
|
// GoldWars
|
||||||
|
//
|
||||||
|
// Created by Jakob Haag on 18.05.20.
|
||||||
|
// Copyright © 2020 SP2. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import SpriteKit
|
||||||
|
import GameplayKit
|
||||||
|
|
||||||
|
class Way: GKEntity {
|
||||||
|
|
||||||
|
required init(fromBase: Base, toBase: Base) {
|
||||||
|
super.init()
|
||||||
|
|
||||||
|
let pathToDraw = CGMutablePath()
|
||||||
|
pathToDraw.move(to: fromBase.position)
|
||||||
|
pathToDraw.addLine(to: toBase.position)
|
||||||
|
|
||||||
|
|
||||||
|
addComponent(DefaultWayComponent(pathToDraw: pathToDraw))
|
||||||
|
}
|
||||||
|
|
||||||
|
required init?(coder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
1331
GoldWars/GoldWars/Map/CElemente.swift
Normal file
1331
GoldWars/GoldWars/Map/CElemente.swift
Normal file
File diff suppressed because it is too large
Load Diff
@ -21,9 +21,13 @@ protocol MapProtocol {
|
|||||||
|
|
||||||
protocol CenterElementProtocol {
|
protocol CenterElementProtocol {
|
||||||
|
|
||||||
|
var bases: [Base] {get set}
|
||||||
|
var ways: [Way] {get set}
|
||||||
|
|
||||||
init(frame: CGRect)
|
init(frame: CGRect)
|
||||||
|
|
||||||
func getAllBases() -> [Base]
|
func getAllBases() -> [Base]
|
||||||
|
func getInternalWays() -> [Way]
|
||||||
func getTopConnection() -> Base?
|
func getTopConnection() -> Base?
|
||||||
func getRightConnection() -> Base?
|
func getRightConnection() -> Base?
|
||||||
func getBottomConnection() -> Base?
|
func getBottomConnection() -> Base?
|
||||||
@ -64,12 +68,27 @@ class CenterElementProvider {
|
|||||||
static let LOG = OSLog.init(subsystem: "MapGenerator", category: "CenterElementProvider")
|
static let LOG = OSLog.init(subsystem: "MapGenerator", category: "CenterElementProvider")
|
||||||
|
|
||||||
static func get(frame: CGRect) -> CenterElementProtocol {
|
static func get(frame: CGRect) -> CenterElementProtocol {
|
||||||
// TODO: Implemented by Jakob
|
|
||||||
os_log("Getting new center element from provider", log: LOG, type: .info)
|
os_log("Getting new center element from provider", log: LOG, type: .info)
|
||||||
|
|
||||||
let centerElements: [CenterElementProtocol.Type] = [
|
let centerElements: [CenterElementProtocol.Type] = [
|
||||||
SampleCElement.self,
|
CElement1.self,
|
||||||
CElement7.self
|
CElement2.self,
|
||||||
|
CElement3.self,
|
||||||
|
CElement4.self,
|
||||||
|
CElement5.self,
|
||||||
|
CElement6.self,
|
||||||
|
CElement7.self,
|
||||||
|
CElement8.self,
|
||||||
|
CElement9.self,
|
||||||
|
CElement10.self,
|
||||||
|
CElement11.self,
|
||||||
|
CElement12.self,
|
||||||
|
CElement13.self,
|
||||||
|
CElement14.self,
|
||||||
|
CElement15.self,
|
||||||
|
CElement16.self,
|
||||||
|
CElement17.self,
|
||||||
|
CElement18.self
|
||||||
]
|
]
|
||||||
|
|
||||||
return centerElements.randomElement()!.init(frame: frame)
|
return centerElements.randomElement()!.init(frame: frame)
|
||||||
|
@ -57,7 +57,7 @@ class SampleCElement : CenterElementProtocol {
|
|||||||
import Foundation
|
import Foundation
|
||||||
import SpriteKit
|
import SpriteKit
|
||||||
|
|
||||||
class CElement7 : CenterElementProtocol {
|
class CElement1700 : CenterElementProtocol {
|
||||||
var frame: CGRect
|
var frame: CGRect
|
||||||
var bases: [Base] = []
|
var bases: [Base] = []
|
||||||
var topBase: Base
|
var topBase: Base
|
||||||
|
@ -38,15 +38,23 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
let p1StartBaseCount = Int.random(in: 1...3)
|
let p1StartBaseCount = Int.random(in: 1...3)
|
||||||
var p1StartBases = [String: Base]()
|
var p1StartBases = [String: Base]()
|
||||||
|
|
||||||
|
var ways = [Way]()
|
||||||
|
|
||||||
if (p1StartBaseCount == 1) {
|
if (p1StartBaseCount == 1) {
|
||||||
p1StartBases["mid"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.5))
|
p1StartBases["mid"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.5))
|
||||||
|
ways.append(Way(fromBase: basePlayerOne, toBase: p1StartBases["mid"]!))
|
||||||
} else if (p1StartBaseCount == 2) {
|
} else if (p1StartBaseCount == 2) {
|
||||||
p1StartBases["top"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.333))
|
p1StartBases["top"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.333))
|
||||||
p1StartBases["bot"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.666))
|
p1StartBases["bot"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.666))
|
||||||
|
ways.append(Way(fromBase: basePlayerOne, toBase: p1StartBases["top"]!))
|
||||||
|
ways.append(Way(fromBase: basePlayerOne, toBase: p1StartBases["bot"]!))
|
||||||
} else {
|
} else {
|
||||||
p1StartBases["top"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.25))
|
p1StartBases["top"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.25))
|
||||||
p1StartBases["mid"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.5))
|
p1StartBases["mid"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.5))
|
||||||
p1StartBases["bot"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.75))
|
p1StartBases["bot"] = Base(position: CGPoint(x: self.size.width * 0.2, y: self.size.height * 0.75))
|
||||||
|
ways.append(Way(fromBase: basePlayerOne, toBase: p1StartBases["top"]!))
|
||||||
|
ways.append(Way(fromBase: basePlayerOne, toBase: p1StartBases["mid"]!))
|
||||||
|
ways.append(Way(fromBase: basePlayerOne, toBase: p1StartBases["bot"]!))
|
||||||
}
|
}
|
||||||
|
|
||||||
os_log("Generate Map center", log: LOG, type: .info)
|
os_log("Generate Map center", log: LOG, type: .info)
|
||||||
@ -63,15 +71,15 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
).insetBy(dx: cellInsetX, dy: cellInsetY)
|
).insetBy(dx: cellInsetX, dy: cellInsetY)
|
||||||
|
|
||||||
let gridTopRight = CGRect(
|
let gridTopRight = CGRect(
|
||||||
x: self.size.width * 0.3,
|
x: self.size.width * 0.5,
|
||||||
y: self.size.height * 0.5,
|
y: self.size.height * 0.1,
|
||||||
width: gridCellWidth,
|
width: gridCellWidth,
|
||||||
height: gridCellHeight
|
height: gridCellHeight
|
||||||
).insetBy(dx: cellInsetX, dy: cellInsetY)
|
).insetBy(dx: cellInsetX, dy: cellInsetY)
|
||||||
|
|
||||||
let gridBottomLeft = CGRect(
|
let gridBottomLeft = CGRect(
|
||||||
x: self.size.width * 0.5,
|
x: self.size.width * 0.3,
|
||||||
y: self.size.height * 0.1,
|
y: self.size.height * 0.5,
|
||||||
width: gridCellWidth,
|
width: gridCellWidth,
|
||||||
height: gridCellHeight
|
height: gridCellHeight
|
||||||
).insetBy(dx: cellInsetX, dy: cellInsetY)
|
).insetBy(dx: cellInsetX, dy: cellInsetY)
|
||||||
@ -88,6 +96,11 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
let bottomLeft = CenterElementProvider.get(frame: gridBottomLeft)
|
let bottomLeft = CenterElementProvider.get(frame: gridBottomLeft)
|
||||||
let bottomRight = CenterElementProvider.get(frame: gridBottomRight)
|
let bottomRight = CenterElementProvider.get(frame: gridBottomRight)
|
||||||
|
|
||||||
|
ways.append(contentsOf: topLeft.getInternalWays())
|
||||||
|
ways.append(contentsOf: topRight.getInternalWays())
|
||||||
|
ways.append(contentsOf: bottomLeft.getInternalWays())
|
||||||
|
ways.append(contentsOf: bottomRight.getInternalWays())
|
||||||
|
|
||||||
os_log("Get player two base", log: LOG, type: .info)
|
os_log("Get player two base", log: LOG, type: .info)
|
||||||
let basePlayerTwo = Base(
|
let basePlayerTwo = Base(
|
||||||
position: CGPoint(x: self.size.width * 0.93, y: self.size.height / 2),
|
position: CGPoint(x: self.size.width * 0.93, y: self.size.height / 2),
|
||||||
@ -101,13 +114,19 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
|
|
||||||
if (p2StartBaseCount == 1) {
|
if (p2StartBaseCount == 1) {
|
||||||
p2StartBases["mid"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.5))
|
p2StartBases["mid"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.5))
|
||||||
|
ways.append(Way(fromBase: basePlayerTwo, toBase: p2StartBases["mid"]!))
|
||||||
} else if (p1StartBaseCount == 2) {
|
} else if (p1StartBaseCount == 2) {
|
||||||
p2StartBases["top"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.333))
|
p2StartBases["top"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.333))
|
||||||
p2StartBases["bot"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.666))
|
p2StartBases["bot"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.666))
|
||||||
|
ways.append(Way(fromBase: basePlayerTwo, toBase: p2StartBases["top"]!))
|
||||||
|
ways.append(Way(fromBase: basePlayerTwo, toBase: p2StartBases["bot"]!))
|
||||||
} else {
|
} else {
|
||||||
p2StartBases["top"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.25))
|
p2StartBases["top"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.25))
|
||||||
p2StartBases["mid"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.5))
|
p2StartBases["mid"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.5))
|
||||||
p2StartBases["bot"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.75))
|
p2StartBases["bot"] = Base(position: CGPoint(x: self.size.width * 0.8, y: self.size.height * 0.75))
|
||||||
|
ways.append(Way(fromBase: basePlayerTwo, toBase: p2StartBases["top"]!))
|
||||||
|
ways.append(Way(fromBase: basePlayerTwo, toBase: p2StartBases["mid"]!))
|
||||||
|
ways.append(Way(fromBase: basePlayerTwo, toBase: p2StartBases["bot"]!))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create adjacency mapping
|
// Create adjacency mapping
|
||||||
@ -119,6 +138,7 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
os_log("Connecting p1 startbase top with topLeft segment", log: LOG, type: .info)
|
os_log("Connecting p1 startbase top with topLeft segment", log: LOG, type: .info)
|
||||||
p1StartBases["top"]!.adjacencyList.append(topLeft.getLeftConnection()!)
|
p1StartBases["top"]!.adjacencyList.append(topLeft.getLeftConnection()!)
|
||||||
topLeft.getLeftConnection()!.adjacencyList.append(p1StartBases["top"]!)
|
topLeft.getLeftConnection()!.adjacencyList.append(p1StartBases["top"]!)
|
||||||
|
ways.append(Way(fromBase: p1StartBases["top"]!, toBase: topLeft.getLeftConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p1StartBases["mid"] != nil) {
|
if (p1StartBases["mid"] != nil) {
|
||||||
@ -126,12 +146,14 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
os_log("Connecting p1 startbase mid with topLeft segment", log: LOG, type: .info)
|
os_log("Connecting p1 startbase mid with topLeft segment", log: LOG, type: .info)
|
||||||
p1StartBases["mid"]!.adjacencyList.append(topLeft.getLeftConnection()!)
|
p1StartBases["mid"]!.adjacencyList.append(topLeft.getLeftConnection()!)
|
||||||
topLeft.getLeftConnection()!.adjacencyList.append(p1StartBases["mid"]!)
|
topLeft.getLeftConnection()!.adjacencyList.append(p1StartBases["mid"]!)
|
||||||
|
ways.append(Way(fromBase: p1StartBases["mid"]!, toBase: topLeft.getLeftConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bottomLeft.getLeftConnection() != nil) {
|
if (bottomLeft.getLeftConnection() != nil) {
|
||||||
os_log("Connecting p1 startbase mid with bottomLeft segment", log: LOG, type: .info)
|
os_log("Connecting p1 startbase mid with bottomLeft segment", log: LOG, type: .info)
|
||||||
p1StartBases["mid"]!.adjacencyList.append(bottomLeft.getLeftConnection()!)
|
p1StartBases["mid"]!.adjacencyList.append(bottomLeft.getLeftConnection()!)
|
||||||
bottomLeft.getLeftConnection()!.adjacencyList.append(p1StartBases["mid"]!)
|
bottomLeft.getLeftConnection()!.adjacencyList.append(p1StartBases["mid"]!)
|
||||||
|
ways.append(Way(fromBase: p1StartBases["mid"]!, toBase: bottomLeft.getLeftConnection()!))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,30 +161,35 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
os_log("Connecting p1 startbase bot with bottomLeft segment", log: LOG, type: .info)
|
os_log("Connecting p1 startbase bot with bottomLeft segment", log: LOG, type: .info)
|
||||||
p1StartBases["bot"]!.adjacencyList.append(bottomLeft.getLeftConnection()!)
|
p1StartBases["bot"]!.adjacencyList.append(bottomLeft.getLeftConnection()!)
|
||||||
bottomLeft.getLeftConnection()!.adjacencyList.append(p1StartBases["bot"]!)
|
bottomLeft.getLeftConnection()!.adjacencyList.append(p1StartBases["bot"]!)
|
||||||
|
ways.append(Way(fromBase: p1StartBases["bot"]!, toBase: bottomLeft.getLeftConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topLeft.getRightConnection() != nil && topRight.getLeftConnection() != nil) {
|
if (topLeft.getRightConnection() != nil && topRight.getLeftConnection() != nil) {
|
||||||
os_log("Connecting topLeft with topRight segment horizontally", log: LOG, type: .info)
|
os_log("Connecting topLeft with topRight segment horizontally", log: LOG, type: .info)
|
||||||
topLeft.getRightConnection()!.adjacencyList.append(topRight.getLeftConnection()!)
|
topLeft.getRightConnection()!.adjacencyList.append(topRight.getLeftConnection()!)
|
||||||
topRight.getLeftConnection()!.adjacencyList.append(topLeft.getRightConnection()!)
|
topRight.getLeftConnection()!.adjacencyList.append(topLeft.getRightConnection()!)
|
||||||
|
ways.append(Way(fromBase: topLeft.getRightConnection()!, toBase: topRight.getLeftConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bottomLeft.getRightConnection() != nil && bottomRight.getLeftConnection() != nil) {
|
if (bottomLeft.getRightConnection() != nil && bottomRight.getLeftConnection() != nil) {
|
||||||
os_log("Connecting bottomLeft with bottomRight segment horizontally", log: LOG, type: .info)
|
os_log("Connecting bottomLeft with bottomRight segment horizontally", log: LOG, type: .info)
|
||||||
bottomLeft.getRightConnection()!.adjacencyList.append(bottomRight.getLeftConnection()!)
|
bottomLeft.getRightConnection()!.adjacencyList.append(bottomRight.getLeftConnection()!)
|
||||||
bottomRight.getLeftConnection()!.adjacencyList.append(bottomLeft.getRightConnection()!)
|
bottomRight.getLeftConnection()!.adjacencyList.append(bottomLeft.getRightConnection()!)
|
||||||
|
ways.append(Way(fromBase: bottomLeft.getRightConnection()!, toBase: bottomRight.getLeftConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topLeft.getBottomConnection() != nil && bottomLeft.getTopConnection() != nil) {
|
if (topLeft.getBottomConnection() != nil && bottomLeft.getTopConnection() != nil) {
|
||||||
os_log("Connecting topLeft with bottomLeft segment vertically", log: LOG, type: .info)
|
os_log("Connecting topLeft with bottomLeft segment vertically", log: LOG, type: .info)
|
||||||
topLeft.getBottomConnection()!.adjacencyList.append(bottomLeft.getTopConnection()!)
|
topLeft.getBottomConnection()!.adjacencyList.append(bottomLeft.getTopConnection()!)
|
||||||
bottomLeft.getTopConnection()!.adjacencyList.append(topLeft.getBottomConnection()!)
|
bottomLeft.getTopConnection()!.adjacencyList.append(topLeft.getBottomConnection()!)
|
||||||
|
ways.append(Way(fromBase: topLeft.getBottomConnection()!, toBase: bottomLeft.getTopConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (topRight.getBottomConnection() != nil && bottomRight.getTopConnection() != nil) {
|
if (topRight.getBottomConnection() != nil && bottomRight.getTopConnection() != nil) {
|
||||||
os_log("Connecting topRight with bottomRight segment vertically", log: LOG, type: .info)
|
os_log("Connecting topRight with bottomRight segment vertically", log: LOG, type: .info)
|
||||||
topRight.getBottomConnection()!.adjacencyList.append(bottomRight.getTopConnection()!)
|
topRight.getBottomConnection()!.adjacencyList.append(bottomRight.getTopConnection()!)
|
||||||
bottomRight.getTopConnection()!.adjacencyList.append(topRight.getBottomConnection()!)
|
bottomRight.getTopConnection()!.adjacencyList.append(topRight.getBottomConnection()!)
|
||||||
|
ways.append(Way(fromBase: topRight.getBottomConnection()!, toBase: bottomRight.getTopConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
os_log("Connecting base p2 and start bases", log: LOG, type: .info)
|
os_log("Connecting base p2 and start bases", log: LOG, type: .info)
|
||||||
@ -173,6 +200,7 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
os_log("Connecting p2 startbase top with topRight segment", log: LOG, type: .info)
|
os_log("Connecting p2 startbase top with topRight segment", log: LOG, type: .info)
|
||||||
p2StartBases["top"]!.adjacencyList.append(topRight.getRightConnection()!)
|
p2StartBases["top"]!.adjacencyList.append(topRight.getRightConnection()!)
|
||||||
topRight.getRightConnection()!.adjacencyList.append(p2StartBases["top"]!)
|
topRight.getRightConnection()!.adjacencyList.append(p2StartBases["top"]!)
|
||||||
|
ways.append(Way(fromBase: p2StartBases["top"]!, toBase: topRight.getRightConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p2StartBases["mid"] != nil) {
|
if (p2StartBases["mid"] != nil) {
|
||||||
@ -180,12 +208,14 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
os_log("Connecting p2 startbase mid with topRight segment", log: LOG, type: .info)
|
os_log("Connecting p2 startbase mid with topRight segment", log: LOG, type: .info)
|
||||||
p2StartBases["mid"]!.adjacencyList.append(topRight.getRightConnection()!)
|
p2StartBases["mid"]!.adjacencyList.append(topRight.getRightConnection()!)
|
||||||
topRight.getRightConnection()!.adjacencyList.append(p2StartBases["mid"]!)
|
topRight.getRightConnection()!.adjacencyList.append(p2StartBases["mid"]!)
|
||||||
|
ways.append(Way(fromBase: topRight.getRightConnection()!, toBase: p2StartBases["mid"]!))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bottomRight.getRightConnection() != nil) {
|
if (bottomRight.getRightConnection() != nil) {
|
||||||
os_log("Connecting p2 startbase mid with bottomRight segment", log: LOG, type: .info)
|
os_log("Connecting p2 startbase mid with bottomRight segment", log: LOG, type: .info)
|
||||||
p2StartBases["mid"]!.adjacencyList.append(bottomRight.getRightConnection()!)
|
p2StartBases["mid"]!.adjacencyList.append(bottomRight.getRightConnection()!)
|
||||||
bottomRight.getRightConnection()!.adjacencyList.append(p2StartBases["mid"]!)
|
bottomRight.getRightConnection()!.adjacencyList.append(p2StartBases["mid"]!)
|
||||||
|
ways.append(Way(fromBase: p2StartBases["mid"]!, toBase: bottomRight.getRightConnection()!))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,6 +223,7 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
os_log("Connecting p2 startbase bot with bottomRight segment", log: LOG, type: .info)
|
os_log("Connecting p2 startbase bot with bottomRight segment", log: LOG, type: .info)
|
||||||
p2StartBases["bot"]!.adjacencyList.append(bottomRight.getRightConnection()!)
|
p2StartBases["bot"]!.adjacencyList.append(bottomRight.getRightConnection()!)
|
||||||
bottomRight.getRightConnection()!.adjacencyList.append(p2StartBases["bot"]!)
|
bottomRight.getRightConnection()!.adjacencyList.append(p2StartBases["bot"]!)
|
||||||
|
ways.append(Way(fromBase: p2StartBases["bot"]!, toBase: bottomRight.getRightConnection()!))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -208,6 +239,12 @@ class TwoPlayerMapGenerator: MapProtocol {
|
|||||||
entityManager.add(basePlayerTwo)
|
entityManager.add(basePlayerTwo)
|
||||||
p2StartBases.forEach({(key, base) in entityManager.add(base)})
|
p2StartBases.forEach({(key, base) in entityManager.add(base)})
|
||||||
|
|
||||||
|
ways.forEach({way in entityManager.add(way)})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
func createPathFromBaseToBase(fromBase: Base, toBase: Base) {
|
||||||
|
let path = Way(fromBase: fromBase, toBase: toBase)
|
||||||
|
entityManager.add(path)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user