38 lines
862 B
C#
38 lines
862 B
C#
using Godot;
|
|
using System;
|
|
|
|
public class DebugUI : Control
|
|
{
|
|
[Export]
|
|
public NodePath TicksLabelPath { private get; set; }
|
|
private Label _ticksLabel;
|
|
|
|
[Export]
|
|
public NodePath PauseLabelPath { private get; set; }
|
|
private Label _pauseLabel;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_ticksLabel = GetNode<Label>(TicksLabelPath);
|
|
_pauseLabel = GetNode<Label>(PauseLabelPath);
|
|
|
|
SetTicksText(0);
|
|
SetPauseText(false);
|
|
}
|
|
|
|
#region Signals
|
|
public void _on_Clock_OnPauseChanged(bool paused) => SetPauseText(paused);
|
|
public void _on_Clock_OnTick(int ticks) => SetTicksText(ticks);
|
|
#endregion
|
|
|
|
private void SetTicksText(int ticks)
|
|
{
|
|
_ticksLabel.Text = $"ticks: {ticks}";
|
|
}
|
|
|
|
private void SetPauseText(bool paused)
|
|
{
|
|
_pauseLabel.Text = $"pause: {paused}";
|
|
}
|
|
}
|