authority/modules/authority/player_actor.cpp

28 lines
615 B
C++

#include "player_actor.h"
#include "authority/player_input.h"
void PlayerActor::_bind_methods() {
}
void PlayerActor::ready() {
PlayerInput *input{ cast_to<PlayerInput>(get_node(NodePath("%PlayerInput"))) };
input->connect(PlayerInput::signal_movement, callable_mp(this, &self_type::input_move));
}
void PlayerActor::input_move(Vector2 movement) {
set_movement_direction({ movement.x, 0.f, movement.y });
}
void PlayerActor::_notification(int what) {
if (Engine::get_singleton()->is_editor_hint()) {
return;
}
switch (what) {
default:
return;
case NOTIFICATION_READY:
ready();
return;
}
}