feat: last known player transform now updates in _process

main
Sara 2024-12-25 18:25:07 +01:00
parent dc1e09d425
commit c7ae756776
1 changed files with 5 additions and 5 deletions

View File

@ -37,6 +37,11 @@ void Enemy::_process(double delta) {
this->rotate_y(step);
this->at_target_angle = false;
}
if(this->can_see_player) {
this->last_known_player_position = this->player->get_global_position();
this->last_known_player_rotation = -this->player->get_global_rotation().y;
this->shots_fired = 0;
}
}
void Enemy::_on_velocity_calculated(gd::Vector3 velocity) {
@ -45,11 +50,6 @@ void Enemy::_on_velocity_calculated(gd::Vector3 velocity) {
}
void Enemy::update() {
if(this->can_see_player) {
this->last_known_player_position = this->player->get_global_position();
this->last_known_player_rotation = -this->player->get_global_rotation().y;
this->shots_fired = 0;
}
if(this->current_action_fn != nullptr)
this->current_action_fn = (ActionFn)(this->*current_action_fn)();
}