setLabel Names
This commit is contained in:
parent
f363d30f15
commit
8df133f896
@ -35,8 +35,10 @@ class HUD: GKEntity {
|
||||
|
||||
init(size: CGSize) {
|
||||
hostLabel = SKLabelNode(text: GameCenterManager.sharedInstance.hostingPlayer?.displayName)
|
||||
hostLabel.name = "hostLabel"
|
||||
hostUnitsLabel = SKLabelNode(text: "500" )
|
||||
peerLabel = SKLabelNode(text: GameCenterManager.sharedInstance.peerPlayer?.displayName)
|
||||
peerLabel.name = "peerLabel"
|
||||
peerUnitsLabel = SKLabelNode(text: "500")
|
||||
|
||||
roundTimerLabel = SKLabelNode(text: "")
|
||||
|
@ -47,7 +47,7 @@ class RoundTimer: Timer {
|
||||
|
||||
@objc func onTimerFires()
|
||||
{
|
||||
|
||||
timeLeft -= 1
|
||||
EntityManager.gameEMInstance.updateTime(time: (timeLeft > 0 ? String(timeLeft) : roundEnded))
|
||||
|
||||
if timeLeft == 0 {
|
||||
@ -56,6 +56,7 @@ class RoundTimer: Timer {
|
||||
if !MultiplayerNetwork.sharedInstance.isSending {
|
||||
MultiplayerNetwork.sharedInstance.sendPlayerMoves(localRoundData: DataService.sharedInstance.localRoundData)
|
||||
}
|
||||
calculate = true
|
||||
if timeLeft <= 0 {
|
||||
if calculate
|
||||
&& !RoundCalculatorService.sharedInstance.isCalculating
|
||||
|
@ -29,6 +29,7 @@ class GameScene: SKScene{
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
override func didMove(to view: SKView) {
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(pauseGame), name: Notification.Name("pauseGame"), object: nil)
|
||||
NotificationCenter.default.addObserver(self, selector: #selector(resumeGame), name: Notification.Name("resumeGame"), object: nil)
|
||||
@ -78,6 +79,7 @@ class GameScene: SKScene{
|
||||
override func update(_ currentTime: TimeInterval) {
|
||||
if entityManager.entities.count != 0 {
|
||||
entityManager.getBackground()?.update(deltaTime: currentTime)
|
||||
print("Update")
|
||||
if GameCenterManager.sharedInstance.gameEnded && !gameEndEffects {
|
||||
gameEnd()
|
||||
}
|
||||
@ -127,6 +129,7 @@ class GameScene: SKScene{
|
||||
}
|
||||
|
||||
func gameEnd(){
|
||||
print("Game END")
|
||||
gameEndEffects = true
|
||||
let winnerNode:String?
|
||||
GameCenterManager.sharedInstance.gameEnded = false
|
||||
|
Loading…
Reference in New Issue
Block a user