18 lines
461 B
GDScript
18 lines
461 B
GDScript
class_name VRPN_Button
|
|
extends Node
|
|
|
|
@export var vrpn_client : VRPN_Client = null
|
|
@export var button_sensor : String = "Button0"
|
|
@export var register_on_ready : bool = true
|
|
|
|
var state : int = 0
|
|
|
|
func _ready():
|
|
if not vrpn_client:
|
|
push_warning("No VRPN client for button on '%s' given." % [self.name])
|
|
elif register_on_ready:
|
|
vrpn_client.buttons.append(self)
|
|
|
|
func _on_vrpn(vrpn_data : Dictionary) -> void:
|
|
if vrpn_data['sensor'] == button_sensor:
|
|
pass
|