This commit is contained in:
aozhiwei 2023-04-04 10:34:36 +08:00
parent 6102b0714a
commit 0097af1830

View File

@ -8,6 +8,9 @@
#include "movement.h"
#include "trigger.h"
#include "glmhelper.h"
#include "mapinstance.h"
#include "mt/Map.h"
HeroAgent::HeroAgent():BaseAgent()
{
@ -446,7 +449,25 @@ behaviac::EBTStatus HeroAgent::DoHelpAttack(int target_uniid)
behaviac::EBTStatus HeroAgent::FlyToMasterAround()
{
if (!GetOwner()->AsHero()->master.Get()) {
return behaviac::BT_FAILURE;
}
glm::vec3 ref_point = GetOwner()->AsHero()->master.Get()->GetPos().ToGlmVec3();
glm::vec3 point = GetOwner()->AsHero()->master.Get()->GetPos().ToGlmVec3();
GetOwner()->room->map_instance->Scale(ref_point);
if (GetOwner()->room->map_instance->FindRandomPointAroundCircle
(
ref_point,
30 * GetOwner()->room->GetMapMeta()->scale(),
point
)) {
GetOwner()->room->map_instance->UnScale(point);
}
Global::Instance()->verify_set_pos = 1;
GetOwner()->GetMutablePos().FromGlmVec3(point);
Global::Instance()->verify_set_pos = 0;
GetOwner()->room->grid_service->MoveCreature(GetOwner());
return behaviac::BT_SUCCESS;
}
behaviac::EBTStatus HeroAgent::FollowMaster()