Revert "Merge branch '33-basisownership-anhand-des-gkplayers' into 'development'"

This reverts merge request !60
This commit is contained in:
Aldin Duraki 2020-05-15 09:10:51 +00:00
parent d595cb4235
commit e87e489e9e
7 changed files with 17 additions and 20 deletions

View File

@ -8,7 +8,6 @@
import SpriteKit
import GameplayKit
import GameKit
class TeamComponent: GKComponent {
let team: Team
@ -30,7 +29,6 @@ class TeamComponent: GKComponent {
}
self.team = team
self.player = player
super.init()
}

View File

@ -22,8 +22,8 @@ class Base: GKEntity {
super.init()
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position))
if(team != nil && player != nil){
addComponent(TeamComponent(team: team!, position: position, player: player!))
if(team != nil){
addComponent(TeamComponent(team: team!, position: position))
self.unitCount = 500
}
}

View File

@ -8,7 +8,6 @@
import SpriteKit
import GameplayKit
import GameKit
class EntityManager {

View File

@ -10,8 +10,6 @@ import GameplayKit
class Modal: GKEntity{
var unitCount:Int
var unitCount:Int
init(modaltype: ModalType, base: Base, anchorPoint: CGPoint, entityManager: EntityManager, gameScene: SKScene) {

View File

@ -21,7 +21,6 @@ class TwoPlayerDefaultTestMap: MapProtocol {
func load() {
// Create Bases
let basePlayerOne = Base(
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2),
@ -47,7 +46,6 @@ class TwoPlayerDefaultTestMap: MapProtocol {
let basePlayerTwo = Base(
position: CGPoint(x: self.size.width * 0.9, y: self.size.height / 2),
player: (!MatchmakingHelper.sharedInstance.isServer) ? GKLocalPlayer.local : MatchmakingHelper.sharedInstance.mpMatch?.players[0],
team: .team2
)

View File

@ -33,6 +33,7 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
var viewController: UIViewController?
var mpMatchStarted: Bool
var isServer: Bool
var spieler1: GKPlayer?
var nameSpieler1 = ""
var menusc: MenuScene?
let localPlayer: GKLocalPlayer = GKLocalPlayer.local
@ -153,9 +154,13 @@ class MatchmakingHelper: NSObject, GKMatchmakerViewControllerDelegate, GKMatchDe
if player == GKLocalPlayer.local {
self.isServer = true
self.spieler1 = player
self.nameSpieler1 = self.spieler1!.displayName
} else {
self.isServer = false
}
self.delegate?.matchStarted()
self.menusc!.loadScene(scene: GameScene(size: self.menusc!.size))
})

View File

@ -8,7 +8,6 @@
import SpriteKit
import GameplayKit
import GameKit
class GameScene: SKScene{
@ -35,8 +34,8 @@ class GameScene: SKScene{
let touchLocation = touch.location(in: self)
if isMoveTouch{
isMoveTouch = false
if isMoveTouch{
isMoveTouch = false
currentDraggedBase!.component(ofType: DefaultBaseComponent.self)?.spriteNode.position = currentDraggedBasePos
currentDraggedBase!.component(ofType: TeamComponent.self)?.fire.position = currentDraggedBasePos
@ -97,7 +96,7 @@ class GameScene: SKScene{
body.text = "Schicke \( ((e.component(ofType: SliderComponent.self)?.sliderNode.getValue ?? 0) * CGFloat((e as! Modal).unitCount)).rounded(.up)) Einheiten "
} }
let bases = entityManager.getBaseByPlayer(for: GKLocalPlayer.local)
let bases = entityManager.getBasesByTeam(for: .team1)
for base in bases {
if atPoint(touchLocation) == base.component(ofType: DefaultBaseComponent.self)?.spriteNode{