Delete TimerComponent file
This commit is contained in:
parent
f882b7e615
commit
729ee968b3
@ -1,56 +0,0 @@
|
|||||||
//
|
|
||||||
// TimerComponent.swift
|
|
||||||
// GoldWars
|
|
||||||
//
|
|
||||||
// Created by Daniel Steckert on 05.05.20.
|
|
||||||
// Copyright © 2020 SP2. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import GameplayKit
|
|
||||||
|
|
||||||
class TimerComponent: GKComponent {
|
|
||||||
|
|
||||||
let labelNode :SKLabelNode
|
|
||||||
let roundTimer: RoundTimer
|
|
||||||
init(anchorPoint: CGPoint) {
|
|
||||||
self.labelNode = SKLabelNode(text: "")
|
|
||||||
self.labelNode.fontColor = UIColor.black
|
|
||||||
self.labelNode.fontSize = CGFloat(45)
|
|
||||||
self.labelNode.position = CGPoint(x: anchorPoint.x, y: anchorPoint.y - 15)
|
|
||||||
self.roundTimer = RoundTimer()
|
|
||||||
super.init()
|
|
||||||
startWithDuration()
|
|
||||||
}
|
|
||||||
|
|
||||||
func startWithDuration(){
|
|
||||||
print("startWithDuration")
|
|
||||||
roundTimer.startTimer()
|
|
||||||
RoundCalculatorService.sharedInstance.isCalculating = false
|
|
||||||
}
|
|
||||||
|
|
||||||
func timeLeft() -> Int {
|
|
||||||
self.roundTimer.timeLeft
|
|
||||||
}
|
|
||||||
|
|
||||||
func update() {
|
|
||||||
self.labelNode.text = String(timeLeft())
|
|
||||||
|
|
||||||
if(isFinished()){
|
|
||||||
self.labelNode.text = "Synching"
|
|
||||||
RoundCalculatorService.sharedInstance.resetNumberOfAttacksAndFormats()
|
|
||||||
if !MultiplayerNetwork.sharedInstance.isSending {
|
|
||||||
MultiplayerNetwork.sharedInstance.sendPlayerMoves(localRoundData: DataService.sharedInstance.localRoundData)
|
|
||||||
}
|
|
||||||
if !RoundCalculatorService.sharedInstance.isCalculating
|
|
||||||
&& DataService.sharedInstance.didReceiveAllData()
|
|
||||||
&& GameCenterManager.sharedInstance.isServer {
|
|
||||||
RoundCalculatorService.sharedInstance.calculateRound()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
required init?(coder: NSCoder) {
|
|
||||||
fatalError("init(coder:) has not been implemented")
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user