1
This commit is contained in:
parent
661d96be4d
commit
7e06d0e40b
@ -1156,17 +1156,45 @@ behaviac::EBTStatus HeroAgent::CoGetNextMobaModeRoadPoint()
|
||||
++r;
|
||||
}
|
||||
if (paths.empty()) {
|
||||
std::shared_ptr<std::tuple<std::shared_ptr<mt::WorldObject>, int, int>> path;
|
||||
int r = 0;
|
||||
for (auto& road : GetRoom()->GetMapMeta()->moba_path_points) {
|
||||
int p = 0;
|
||||
for (auto itr = road.begin(); itr != road.end(); ++itr) {
|
||||
auto& point = std::get<0>(*itr);
|
||||
if (!path) {
|
||||
path = std::make_shared<std::tuple<std::shared_ptr<mt::WorldObject>, int, int>>
|
||||
(
|
||||
std::make_tuple
|
||||
(
|
||||
point,
|
||||
r,
|
||||
p
|
||||
)
|
||||
);
|
||||
} else {
|
||||
if (owner_->GetPos().Distance2D2(point->pos) <
|
||||
owner_->GetPos().Distance2D2(std::get<0>(*path)->pos)) {
|
||||
|
||||
} else {
|
||||
auto& path = paths.at(rand() % paths.size());
|
||||
owner_->road_idx = std::get<1>(path);
|
||||
owner_->point_idx = std::get<2>(path);
|
||||
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);
|
||||
}
|
||||
}
|
||||
++p;
|
||||
}
|
||||
++r;
|
||||
}
|
||||
if (!path) {
|
||||
abort();
|
||||
}
|
||||
paths.push_back(*path);
|
||||
}
|
||||
auto& path = paths.at(rand() % paths.size());
|
||||
owner_->road_idx = std::get<1>(path);
|
||||
owner_->point_idx = std::get<2>(path);
|
||||
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);
|
||||
}
|
||||
}
|
||||
return behaviac::BT_SUCCESS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user