47 lines
2 KiB
GDScript
47 lines
2 KiB
GDScript
extends Node
|
|
|
|
class_name InputManagementComponent
|
|
|
|
#instead of setting up keybinds in 3 differents scripts, it's centralized in this one only
|
|
|
|
@export_group("Keybind variables")
|
|
@export_subgroup("Player character variables")
|
|
@export var move_forward_action : StringName = "player_move_forward"
|
|
@export var move_backward_action : StringName = "player_move_backward"
|
|
@export var move_left_action : StringName = "player_move_left"
|
|
@export var move_right_action : StringName = "player_move_right"
|
|
@export var run_action : StringName = "player_run"
|
|
@export var jump_action : StringName = "player_jump"
|
|
@export_subgroup("Camera variables")
|
|
@export var aim_cam_action : StringName = "player_aim_camera"
|
|
@export var cam_zoom_in_action : StringName = "player_zoom_camera_in"
|
|
@export var cam_zoom_out_action : StringName = "player_zoom_camera_out"
|
|
@export var cam_look_up_action : StringName = "player_look_up"
|
|
@export var cam_look_down_action : StringName = "player_look_down"
|
|
@export var cam_look_left_action : StringName = "player_look_left"
|
|
@export var cam_look_right_action : StringName = "player_look_right"
|
|
|
|
#references variables
|
|
@onready var play_char_ref : PlayerCharacter = $".."
|
|
@onready var cam_holder_ref : CameraHolder = %CameraHolder
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
attribute_keybinds()
|
|
|
|
func attribute_keybinds() -> void:
|
|
play_char_ref.move_forward_action = move_forward_action
|
|
play_char_ref.move_backward_action = move_backward_action
|
|
play_char_ref.move_left_action = move_left_action
|
|
play_char_ref.move_right_action = move_right_action
|
|
play_char_ref.run_action = run_action
|
|
play_char_ref.jump_action = jump_action
|
|
|
|
cam_holder_ref.aim_cam_action = aim_cam_action
|
|
cam_holder_ref.cam_zoom_in_action = cam_zoom_in_action
|
|
cam_holder_ref.cam_zoom_out_action = cam_zoom_out_action
|
|
cam_holder_ref.cam_look_up_action = cam_look_up_action
|
|
cam_holder_ref.cam_look_down_action = cam_look_down_action
|
|
cam_holder_ref.cam_look_left_action = cam_look_left_action
|
|
cam_holder_ref.cam_look_right_action = cam_look_right_action
|