You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
805 B
37 lines
805 B
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common.Services;
|
|
|
|
public partial class InputService : Node
|
|
{
|
|
public static InputService Instance { get; private set; } = null!;
|
|
|
|
[Signal]
|
|
public delegate void InputEnabledChangedEventHandler(bool enabled);
|
|
|
|
private static bool _inputEnabled = true;
|
|
|
|
public bool InputEnabled
|
|
{
|
|
get => _inputEnabled;
|
|
set
|
|
{
|
|
if (_inputEnabled != value)
|
|
{
|
|
CallDeferred(nameof(SetInputEnabled), value);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void SetInputEnabled(bool enabled)
|
|
{
|
|
_inputEnabled = enabled;
|
|
EmitSignal(SignalName.InputEnabledChanged, _inputEnabled);
|
|
}
|
|
|
|
public override void _EnterTree()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
} |