class_name InputListener extends Node

signal pressed(toggle_state: bool)
signal released(toggle_state: bool)

@export var toggle_state: bool

@export var action: String

func _input(event: InputEvent) -> void:
    if event.is_action_pressed(action):
        self.toggle_state = !toggle_state
        pressed.emit(toggle_state)

    if event.is_action_released(action):
        released.emit(toggle_state)
