This commit is contained in:
aozhiwei 2023-10-31 22:39:03 +08:00
parent b6aa0211aa
commit 16349f02a2

View File

@ -1102,16 +1102,19 @@ behaviac::EBTStatus HeroAgent::CoGetNextMobaModeRoadPoint()
GlmHelper::RotateY(dir, (10 + rand() % 360)/ 180.0f);
GlmHelper::Normalize(dir);
if (owner_->point_idx < road.size()) {
if (owner_->path_dir == 1) {
out_point0 = std::get<0>(road.at(road.size() - owner_->point_idx - 1))->pos;
} else {
out_point0 = std::get<0>(road.at(owner_->point_idx))->pos;
out_point0 += dir * (float)a8::RandEx(0, 100);
}
++owner_->point_idx;
} else {
owner_->point_idx = 0;
owner_->path_dir = owner_->path_dir == 1 ? 0 : 1;
}
if (owner_->path_dir == 1) {
out_point0 = std::get<0>(road.at(road.size() - owner_->point_idx - 1))->pos;
} else {
out_point0 = std::get<0>(road.at(owner_->point_idx))->pos;
out_point0 += dir * (float)a8::RandEx(0, 100);
}
if (owner_->GetPos().Distance2D2(out_point0) > 500) {
}
return behaviac::BT_SUCCESS;
}