feat: last known player transform now updates in _process
parent
dc1e09d425
commit
c7ae756776
|
@ -37,6 +37,11 @@ void Enemy::_process(double delta) {
|
||||||
this->rotate_y(step);
|
this->rotate_y(step);
|
||||||
this->at_target_angle = false;
|
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) {
|
void Enemy::_on_velocity_calculated(gd::Vector3 velocity) {
|
||||||
|
@ -45,11 +50,6 @@ void Enemy::_on_velocity_calculated(gd::Vector3 velocity) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Enemy::update() {
|
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)
|
if(this->current_action_fn != nullptr)
|
||||||
this->current_action_fn = (ActionFn)(this->*current_action_fn)();
|
this->current_action_fn = (ActionFn)(this->*current_action_fn)();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue