Merge branch 'revert-3f73a6f6' into 'development'
Revert "Merge branch '33-basisownership-anhand-des-gkplayers' into 'development'" See merge request marcel.schwarz/software-projekt-2!56
This commit is contained in:
commit
a3361b3752
@ -8,20 +8,17 @@
|
|||||||
|
|
||||||
import SpriteKit
|
import SpriteKit
|
||||||
import GameplayKit
|
import GameplayKit
|
||||||
import GameKit
|
|
||||||
|
|
||||||
class Base: GKEntity {
|
class Base: GKEntity {
|
||||||
|
|
||||||
var unitCount: Int
|
var unitCount: Int
|
||||||
var adjacencyList: Array<Base>
|
var adjacencyList: Array<Base>
|
||||||
var changeOwnerShip: Bool
|
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.unitCount = 0
|
||||||
self.adjacencyList = [Base]()
|
self.adjacencyList = [Base]()
|
||||||
self.changeOwnerShip = false
|
self.changeOwnerShip = false
|
||||||
self.ownerShipPlayer = player
|
|
||||||
super.init()
|
super.init()
|
||||||
|
|
||||||
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position))
|
addComponent(DefaultBaseComponent(texture: SKTexture(imageNamed: "Base"), position: position))
|
||||||
@ -33,7 +30,6 @@ class Base: GKEntity {
|
|||||||
|
|
||||||
func attackBase(base: Base, units:Int) -> [GKEntity]{
|
func attackBase(base: Base, units:Int) -> [GKEntity]{
|
||||||
base.changeOwnerShip = true
|
base.changeOwnerShip = true
|
||||||
base.ownerShipPlayer = self.ownerShipPlayer
|
|
||||||
self.unitCount -= units
|
self.unitCount -= units
|
||||||
base.unitCount += units
|
base.unitCount += units
|
||||||
return [self, base]
|
return [self, base]
|
||||||
|
@ -18,27 +18,17 @@ class Modal: GKEntity{
|
|||||||
switch modaltype{
|
switch modaltype{
|
||||||
case .BaseDetails:
|
case .BaseDetails:
|
||||||
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
|
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
|
||||||
addComponent(ModalContentComponent(
|
addComponent(ModalContentComponent(header: "Basis Information",
|
||||||
header: "Basis Information",
|
|
||||||
body: "Diese Basis enthält \(base.unitCount) Einheiten",
|
body: "Diese Basis enthält \(base.unitCount) Einheiten",
|
||||||
footer: "",
|
footer: "",
|
||||||
anchorPoint: anchorPoint
|
anchorPoint: anchorPoint))
|
||||||
)
|
|
||||||
)
|
|
||||||
case .BaseAttack:
|
case .BaseAttack:
|
||||||
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
|
addComponent(ModalBackgroundComponent(anchorPoint: anchorPoint))
|
||||||
addComponent(SliderComponent(
|
addComponent(SliderComponent(width: 300, position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 80)))
|
||||||
width: 300,
|
addComponent(ModalContentComponent(header: "Angriff",
|
||||||
position: CGPoint(x: anchorPoint.x , y: anchorPoint.y - 80)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
addComponent(ModalContentComponent(
|
|
||||||
header: "Angriff",
|
|
||||||
body: "Schicke \(unitCount / 2) Einheiten",
|
body: "Schicke \(unitCount / 2) Einheiten",
|
||||||
footer: "",
|
footer: "",
|
||||||
anchorPoint: anchorPoint
|
anchorPoint: anchorPoint))
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
import SpriteKit
|
import SpriteKit
|
||||||
import GameKit
|
|
||||||
|
|
||||||
class TwoPlayerDefaultTestMap: MapProtocol {
|
class TwoPlayerDefaultTestMap: MapProtocol {
|
||||||
|
|
||||||
@ -25,8 +24,6 @@ class TwoPlayerDefaultTestMap: MapProtocol {
|
|||||||
// Create Bases
|
// Create Bases
|
||||||
let basePlayerOne = Base(
|
let basePlayerOne = Base(
|
||||||
position: CGPoint(x: self.size.width * 0.1, y: self.size.height / 2),
|
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
|
team: .team1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user