Merge branch 'development' into '44-settings-einfuegen'

# Conflicts:
#   GoldWars/GoldWars/Scenes/MenuScene.swift
This commit is contained in:
Tim Herbst 2020-05-10 18:11:14 +00:00
commit 3f56b033ba
31 changed files with 502 additions and 519 deletions

View File

@ -8,20 +8,17 @@
import SpriteKit
import GameplayKit
import GameKit
class Base: GKEntity {
var unitCount: Int
var adjacencyList: Array<Base>
var changeOwnerShip: Bool
var ownerShipPlayer: GKPlayer?
init(position: CGPoint, player: GKPlayer? = nil, team: Team? = nil) {
init(position: CGPoint, team: Team! = nil) {
self.unitCount = 0
self.adjacencyList = [Base]()
self.changeOwnerShip = false
self.ownerShipPlayer = player
super.init()
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position))
@ -33,7 +30,6 @@ class Base: GKEntity {
func attackBase(base: Base, units:Int) -> [GKEntity]{
base.changeOwnerShip = true
base.ownerShipPlayer = self.ownerShipPlayer
self.unitCount -= units
base.unitCount += units
return [self, base]

View File

@ -18,27 +18,17 @@ class Modal: GKEntity{
switch modaltype{
case .BaseDetails:
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
addComponent(ModalContentComponent(
header: "Basis Information",
addComponent(ModalContentComponent(header: "Basis Information",
body: "Diese Basis enthält \(base.unitCount) Einheiten",
footer: "",
anchorPoint: anchorPoint
)
)
anchorPoint: anchorPoint))
case .BaseAttack:
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
addComponent(SliderComponent(
width: 300,
position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 80)
)
)
addComponent(ModalContentComponent(
header: "Angriff",
addComponent(SliderComponent(width: 300, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 80)))
addComponent(ModalContentComponent(header: "Angriff",
body: "Schicke \(unitCount / 2) Einheiten",
footer: "",
anchorPoint: anchorPoint
)
)
anchorPoint: anchorPoint))
}
}

View File

@ -8,7 +8,6 @@
import Foundation
import SpriteKit
import GameKit
class TwoPlayerDefaultTestMap: MapProtocol {
@ -25,8 +24,6 @@ class TwoPlayerDefaultTestMap: MapProtocol {
// Create Bases
let basePlayerOne = Base(
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2),
// ToDo: not final version. Better would be something like MatchmakingHelper.spieler1 but does not work yet
player: GKLocalPlayer.local,
team: .team1
)