This commit is contained in:
aozhiwei 2022-12-07 16:01:16 +08:00
parent 3099fa99bc
commit d1772dd4b7
3 changed files with 7 additions and 5 deletions

View File

@ -176,15 +176,16 @@ behaviac::EBTStatus AndroidAgent::DoPursuit()
last_pursuit_frameno = GetOwner()->room->GetFrameNo();
} else {
bool is_shot = false;
dir.Normalize();
if (dir.Norm() > 500) {
if (dir.Norm() > 300) {
if (GetOwner()->GetMoveHelper()->GetPathSize() < 1) {
dir.Normalize();
GetOwner()->SetMoveDir(dir);
GetOwner()->SetAttackDir(dir);
GetOwner()->GetMoveHelper()->CalcTargetPos(200);
last_pursuit_frameno = GetOwner()->room->GetFrameNo();
} else {
if (GetOwner()->room->GetFrameNo() - last_pursuit_frameno > SERVER_FRAME_RATE * 1) {
dir.Normalize();
GetOwner()->SetMoveDir(dir);
GetOwner()->SetAttackDir(dir);
GetOwner()->GetMoveHelper()->CalcTargetPos(200);
@ -192,6 +193,7 @@ behaviac::EBTStatus AndroidAgent::DoPursuit()
}
}
} else {
dir.Normalize();
is_shot = true;
}
if (is_shot) {

View File

@ -236,7 +236,7 @@ void MoveHelper::AddPaths(const a8::Vec3& start, std::vector<a8::Vec3>& paths)
last_pos.x = paths[i].x;
last_pos.y = paths[i].y;
last_pos.z = paths[i].z;
#ifdef DEBUG
#ifdef DEBUG1
a8::XPrintf("AddPaths size:%d i:%d src_pos:%f,%f tar_pos:%f:%f\n",
{
paths.size(),

View File

@ -423,9 +423,9 @@ Human* Room::FindEnemy(Human* hum, float range)
a8::XParams(),
[&target, myself, range, &last_distance] (Human* hum, a8::XParams& param)
{
if (!target->dead &&
if (!hum->dead &&
hum->team_id != myself->team_id) {
float distance = hum->GetPos().Distance(target->GetPos());
float distance = hum->GetPos().Distance(myself->GetPos());
if (distance <= range) {
if (distance < last_distance) {
target = hum;