This commit is contained in:
aozhiwei 2023-10-24 13:41:25 +08:00
parent 1d34a4c892
commit f902ead3b1

View File

@ -950,6 +950,9 @@ behaviac::EBTStatus HeroAgent::CoGetRunAwayPoint()
if (!current_target_agent->IsValid()) { if (!current_target_agent->IsValid()) {
return behaviac::BT_FAILURE; return behaviac::BT_FAILURE;
} }
if (context->try_count >= 3) {
return behaviac::BT_FAILURE;
}
glm::vec3 gas_center = GlmHelper::Vec2ToVec3(owner_->room->GetGasData().pos_new); glm::vec3 gas_center = GlmHelper::Vec2ToVec3(owner_->room->GetGasData().pos_new);
gas_center.y = owner_->GetPos().ToGlmVec3().y; gas_center.y = owner_->GetPos().ToGlmVec3().y;
@ -972,7 +975,8 @@ behaviac::EBTStatus HeroAgent::CoGetRunAwayPoint()
out_point0 = point; out_point0 = point;
return behaviac::BT_SUCCESS; return behaviac::BT_SUCCESS;
} }
return behaviac::BT_FAILURE; ++context->try_count;
return behaviac::BT_RUNNING;
}; };
return StartCoroutine(co); return StartCoroutine(co);
} }