feat: started work on reloading

This commit is contained in:
Sara 2025-08-05 16:20:55 +02:00
parent 2d720a983a
commit 150231c67c
17 changed files with 63 additions and 33 deletions

View file

@ -10,6 +10,7 @@ String PlayerInput::sig_run{ "run" };
String PlayerInput::sig_jump{ "jump" };
String PlayerInput::sig_crouch{ "crouch" };
String PlayerInput::sig_activate{ "activate" };
String PlayerInput::sig_reload{ "reload" };
void PlayerInput::_bind_methods() {
ADD_SIGNAL(MethodInfo(sig_movement_input, PropertyInfo(Variant::VECTOR2, "axes")));
@ -21,6 +22,7 @@ void PlayerInput::_bind_methods() {
ADD_SIGNAL(MethodInfo(sig_jump));
ADD_SIGNAL(MethodInfo(sig_crouch, PropertyInfo(Variant::BOOL, "is_crouching")));
ADD_SIGNAL(MethodInfo(sig_activate));
ADD_SIGNAL(MethodInfo(sig_reload));
}
void PlayerInput::normalize_input() {
@ -88,4 +90,7 @@ void PlayerInput::unhandled_input(Ref<InputEvent> const &event) {
if (event->is_action("activate") && event->is_pressed()) {
emit_signal(sig_activate);
}
if (event->is_action("reload") && event->is_pressed()) {
emit_signal(sig_reload);
}
}