This commit is contained in:
aozhiwei 2023-04-04 13:01:56 +08:00
parent ecf27dc271
commit a71bc0a29f
2 changed files with 24 additions and 2 deletions

View File

@ -71,7 +71,7 @@ void BaseAgent::Exec()
bool BaseAgent::HasTarget(float range)
{
Human* enemy = GetOwner()->room->FindEnemy(GetOwner()->AsHuman(), range);
Creature* enemy = GetOwner()->room->FindEnemy(GetOwner(), range);
return enemy != nullptr;
}

View File

@ -465,6 +465,28 @@ behaviac::EBTStatus HeroAgent::DoFlyToMasterAround()
point
)) {
GetOwner()->room->map_instance->UnScale(point);
#ifdef DEBUG
a8::XPrintf("DoFlyToMasteraround1: %f,%f,%f %f,%f,%f\n",
{point.x,
point.y,
point.z,
GetOwner()->GetPos().GetX(),
GetOwner()->GetPos().GetY(),
GetOwner()->GetPos().GetZ(),
});
#endif
} else {
point = GetOwner()->AsHero()->master.Get()->GetPos().ToGlmVec3();
#ifdef DEBUG
a8::XPrintf("DoFlyToMasteraround2: %f,%f,%f %f,%f,%f\n",
{point.x,
point.y,
point.z,
GetOwner()->GetPos().GetX(),
GetOwner()->GetPos().GetY(),
GetOwner()->GetPos().GetZ(),
});
#endif
}
Global::Instance()->verify_set_pos = 1;
GetOwner()->GetMutablePos().FromGlmVec3(point);
@ -498,7 +520,7 @@ behaviac::EBTStatus HeroAgent::DoFollowMaster()
GetOwner()->AsHero()->master.Get()->GetPos().ToGlmVec3())) {
return behaviac::BT_SUCCESS;
}
glm::vec3 dir = GetOwner()->AsHero()->master.Get()->GetPos().CalcDir(GetOwner()->GetPos());
glm::vec3 dir = GetOwner()->GetPos().CalcDir(GetOwner()->AsHero()->master.Get()->GetPos());
if (GlmHelper::Norm(dir) < 60) {
return behaviac::BT_SUCCESS;
}