half-earth/half-earth/scripts/ui/BuildModeUI.cs

37 lines
657 B
C#

using Godot;
using System;
public class BuildModeUI : Control
{
[Signal]
delegate void OnExit();
[Export]
private NodePath _buildModePath;
private BuildMode _buildMode;
// Called when the node enters the scene tree for the first time.
public override void _Ready()
{
_buildMode = GetNode<BuildMode>(_buildModePath);
Visible = false;
}
public void _on_Exit_pressed()
{
Exit();
}
private void Exit()
{
EmitSignal(nameof(OnExit));
}
public override void _Process(float delta)
{
base._Process(delta);
Visible = _buildMode.Active;
}
}