From 15fb959315772f24e79899cc7e79fc2795a1972f Mon Sep 17 00:00:00 2001 From: Marcel Schwarz Date: Thu, 11 Jun 2020 22:32:47 +0200 Subject: [PATCH] Hide label with unit counts when attacking a base --- GoldWars/GoldWars/Entities/Base.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/GoldWars/GoldWars/Entities/Base.swift b/GoldWars/GoldWars/Entities/Base.swift index e01ba62..a199068 100644 --- a/GoldWars/GoldWars/Entities/Base.swift +++ b/GoldWars/GoldWars/Entities/Base.swift @@ -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)