Hide label with unit counts when attacking a base

This commit is contained in:
Marcel Schwarz 2020-06-11 22:32:47 +02:00
parent e10d57968c
commit 15fb959315

View File

@ -46,11 +46,13 @@ class Base: GKEntity{
if base.ownershipPlayer != GKLocalPlayer.local {
base.changeOwnership = true
}
base.ownershipPlayer = self.ownershipPlayer
self.unitCount -= units
base.unitCount += units
self.component(ofType: DefaultBaseComponent.self)?.labelNode.text = "\(self.unitCount)"
base.component(ofType: DefaultBaseComponent.self)?.labelNode.text = "\(base.unitCount)"
if base.ownershipPlayer == GKLocalPlayer.local {
base.component(ofType: DefaultBaseComponent.self)?.labelNode.text = "\(base.unitCount)"
}
base.ownershipPlayer = self.ownershipPlayer
DataService.sharedInstance.addMove(playerMove: PlayerMove(fromBase: self.baseID,
toBase: base.baseID,
unitCount: units * playerMoveType.rawValue)