-
Notifications
You must be signed in to change notification settings - Fork 1
/
HUD.cs
36 lines (25 loc) · 788 Bytes
/
HUD.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using Godot;
using System;
public class HUD : CanvasLayer {
[Signal]
public delegate void StartGame();
public override void _Ready() {
}
private void _on_btnStart_pressed() {
var message = GetNode<Label>("Message");
message.Text = "";
GetNode<Button>("btnStart").Hide();
EmitSignal("StartGame");
}
public void UpdateScore(int score) {
GetNode<Label>("Score").Text = score.ToString() + " seconds";
}
async public void ShowGameOver() {
var message = GetNode<Label>("Message");
message.Text = "Restart?";
await ToSignal(GetTree().CreateTimer(1), "timeout");
var button = GetNode<Button>("btnStart");
button.Text = "Restart";
button.Show();
}
}