Merge branch '108-fix-label-wenn-basis-von-2-basen-angegriffen-werden' into 'development'

Resolve "Fix Label wenn Basis von 2 Basen angegriffen werden"

Closes #108

See merge request marcel.schwarz/software-projekt-2!129
This commit is contained in:
Aldin Duraki 2020-06-24 13:15:53 +00:00
commit 2b2c86a4de
3 changed files with 6 additions and 3 deletions

View File

@ -49,9 +49,11 @@ class Base: GKEntity{
self.unitCount -= units
base.unitCount += units
self.component(ofType: TeamComponent.self)?.unitcountLabel.text = "\(self.unitCount)"
if base.ownershipPlayer == GKLocalPlayer.local {
if base.component(ofType: TeamComponent.self)?.unitcountLabel.text != "" {
base.component(ofType: TeamComponent.self)?.unitcountLabel.text = "\(base.unitCount)"
}
base.ownershipPlayer = self.ownershipPlayer
DataService.sharedInstance.addMove(playerMove: PlayerMove(fromBase: self.baseID,
toBase: base.baseID,

View File

@ -109,10 +109,11 @@ class Modal: GKEntity{
}
func sendUnits(currentDraggedBase: Base?, touchLocation: CGPoint, gameScene: GameScene, collisionBase: Base?){
let moveType: PlayerMoveType = self.type == ModalType.BaseAttack ? .AtkMove : .TxnMove
for base in currentDraggedBase!.adjacencyList {
if base == collisionBase {
RoundCalculatorService.sharedInstance.increaseMoveCounter(ownBase: currentDraggedBase?.ownershipPlayer == base.ownershipPlayer)
entityManager.update((currentDraggedBase?.doPlayerMoveTypeToBase(base: base, playerMoveType: PlayerMoveType.AtkMove, units: Int(GameScene.sendUnits)))!)
entityManager.update((currentDraggedBase?.doPlayerMoveTypeToBase(base: base, playerMoveType: moveType, units: Int(GameScene.sendUnits)))!)
GameScene.sendUnits = 0
}
}

View File

@ -264,7 +264,7 @@ class GameScene: SKScene{
}
func isAttackMove() -> Bool {
return collisionBase?.ownershipPlayer != currentDraggedBase?.ownershipPlayer
return collisionBase?.ownershipPlayer != currentDraggedBase?.ownershipPlayer && !(collisionBase?.changeOwnership ?? false)
}
@objc func pauseGame() -> Void {