godot-third-person-basic-scene/scenes/controls/control_function.gd

30 lines
466 B
GDScript3
Raw Normal View History

2022-02-12 22:15:01 +00:00
extends HBoxContainer
signal add_pressed( command )
var action = null
func set_label( command ):
$Label.text = command
2022-02-24 22:08:03 +00:00
2022-02-12 22:15:01 +00:00
func set_action( _action ):
action = _action
2022-02-24 22:08:03 +00:00
2022-06-26 13:20:42 +00:00
func set_param(_action, _command, myposition):
2022-02-12 22:15:01 +00:00
set_label(_command)
set_action(_action)
2022-06-26 13:20:42 +00:00
if myposition:
2022-02-12 22:15:01 +00:00
$Add_front.visible = true
$Add.visible = false
else:
$Add_front.visible = false
$Add.visible = true
2022-02-24 22:08:03 +00:00
2022-02-12 22:15:01 +00:00
func _on_add_pressed():
emit_signal( "add_pressed", action, $Label.text )
2022-02-24 22:08:03 +00:00