feat: fixed stabbing attack trigger
parent
7868ef1314
commit
935070c6b4
|
@ -86,9 +86,12 @@ Enemy::ActionFn Enemy::fire() {
|
||||||
Enemy::ActionFn Enemy::wait_end_of_shot() {
|
Enemy::ActionFn Enemy::wait_end_of_shot() {
|
||||||
this->set_current_state_name("Shoot (wait)");
|
this->set_current_state_name("Shoot (wait)");
|
||||||
this->target_rotation = gd::Vector3{0.f, 0.f, 1.f}.signed_angle_to(this->last_known_player_position - this->aim_offset_position(), {0.f, 1.f, 0.f});
|
this->target_rotation = gd::Vector3{0.f, 0.f, 1.f}.signed_angle_to(this->last_known_player_position - this->aim_offset_position(), {0.f, 1.f, 0.f});
|
||||||
|
|
||||||
if(this->at_target_angle && !this->anim_tree->get_current_state().begins_with("Fire") && !this->anim_tree->get_fire_weapon())
|
if(this->at_target_angle && !this->anim_tree->get_current_state().begins_with("Fire") && !this->anim_tree->get_fire_weapon())
|
||||||
return this->shots_fired < this->SHOTS_BEFORE_MOVE ? (ActionFn)&Enemy::fire : (ActionFn)&Enemy::wait_line_of_sight;
|
return this->is_in_stab_range()
|
||||||
|
? (ActionFn)&Enemy::stab
|
||||||
|
: (this->shots_fired < this->SHOTS_BEFORE_MOVE
|
||||||
|
? (ActionFn)&Enemy::fire
|
||||||
|
: (ActionFn)&Enemy::wait_line_of_sight);
|
||||||
return (ActionFn)&Enemy::wait_end_of_shot;
|
return (ActionFn)&Enemy::wait_end_of_shot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ private:
|
||||||
float const AIM_SPEED{8.f};
|
float const AIM_SPEED{8.f};
|
||||||
float const TURN_SPEED{10.f};
|
float const TURN_SPEED{10.f};
|
||||||
float const AIM_OFFSET{-0.18f};
|
float const AIM_OFFSET{-0.18f};
|
||||||
float const STAB_RANGE{2.f};
|
float const STAB_RANGE{3.5f};
|
||||||
float const MOVING_NAV_PRIORITY{.5f};
|
float const MOVING_NAV_PRIORITY{.5f};
|
||||||
float const STATIONARY_NAV_PRIORITY{1.f};
|
float const STATIONARY_NAV_PRIORITY{1.f};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue