Use player move type to update unit count label
This commit is contained in:
parent
0b2b552d16
commit
d05364708b
@ -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 playerMoveType == .TxnMove {
|
||||
base.component(ofType: TeamComponent.self)?.unitcountLabel.text = "\(base.unitCount)"
|
||||
}
|
||||
|
||||
base.ownershipPlayer = self.ownershipPlayer
|
||||
DataService.sharedInstance.addMove(playerMove: PlayerMove(fromBase: self.baseID,
|
||||
toBase: base.baseID,
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user