Merge branch '92-bei-angriff-unitcountlabel-anpassen' into 'development'

Resolve "Bei Angriff unitCountLabel anpassen"

Closes #92

See merge request marcel.schwarz/software-projekt-2!119
This commit is contained in:
Marcel Schwarz 2020-06-12 13:26:15 +00:00
commit f50d00a416

View File

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