This commit is contained in:
aozhiwei 2023-10-24 15:07:07 +08:00
parent 9fa56c1822
commit dd358cfde4

View File

@ -961,13 +961,16 @@ behaviac::EBTStatus HeroAgent::CoGetRunAwayPoint()
out_point0 = gas_center; out_point0 = gas_center;
return behaviac::BT_SUCCESS; return behaviac::BT_SUCCESS;
} }
glm::vec3 dir = gas_center - owner_->GetPos().ToGlmVec3(); glm::vec3 dir = gas_center - owner_->GetPos().ToGlmVec3();
GlmHelper::Normalize(dir); GlmHelper::Normalize(dir);
context->step_len = a8::RandEx(200, 300); context->step_len = a8::RandEx(200, 300);
glm::vec3 center = owner_->GetPos().ToGlmVec3() + glm::vec3 center = gas_center;
dir * (50.0f + (float)context->step_len); if (owner_->room->GetGasData().gas_progress > context->step_len + 50) {
center = gas_center + dir * (owner_->room->GetGasData().gas_progress - context->step_len);
}
GlmHelper::RotateY(dir, (10 + rand() % 360)/ 180.0f);
center = center + dir * (float)context->step_len;
owner_->room->map_instance->Scale(center); owner_->room->map_instance->Scale(center);
glm::vec3 point; glm::vec3 point;
bool ok = owner_->room->map_instance->FindConnectableNearestPoint(center, 50, point); bool ok = owner_->room->map_instance->FindConnectableNearestPoint(center, 50, point);