add finishButton to HUD

This commit is contained in:
Jakob Haag 2020-05-28 16:52:03 +02:00 committed by Aldin Duraki
parent bddd226ffd
commit 99b57cc4cd
2 changed files with 10 additions and 1 deletions

View File

@ -51,6 +51,7 @@ class EntityManager {
scene.addChild(hudEntitiy.atkSkill)
scene.addChild(hudEntitiy.spySkill)
scene.addChild(hudEntitiy.roundTimerLabel)
scene.addChild(hudEntitiy.finishButton)
}
if let spriteNode = entity.component(ofType: DefaultBaseComponent.self) {

View File

@ -27,7 +27,15 @@ class HUD: GKEntity {
var roundTimerLabel: SKLabelNode
let roundTimer: RoundTimer
var finishButton: ButtonNode
init(size: CGSize) {
finishButton = ButtonNode(textureName: "yellow_button04", text: "Finish Round", isEnabled: true, position: CGPoint(x: EntityManager.gameEMInstance.scene.size.width * 0.15, y: EntityManager.gameEMInstance.scene.size.height * 0.1),
onButtonPress: { print("Finish Round") }
)
finishButton.size = CGSize(width: 225, height: 40)
finishButton.zPosition = 4
host = GameCenterManager.sharedInstance.hostingPlayer
peer = GameCenterManager.sharedInstance.peerPlayer
hostLabel = SKLabelNode(text: host?.displayName)