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