1
This commit is contained in:
parent
0097af1830
commit
ecf27dc271
@ -48,16 +48,16 @@ template<> inline behaviac::EBTStatus HeroAgent::_Execute_Method_<METHOD_TYPE_He
|
||||
return this->HeroAgent::DoAttack();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_HeroAgent_FlyToMasterAround { };
|
||||
template<> inline behaviac::EBTStatus HeroAgent::_Execute_Method_<METHOD_TYPE_HeroAgent_FlyToMasterAround>()
|
||||
struct METHOD_TYPE_HeroAgent_DoFlyToMasterAround { };
|
||||
template<> inline behaviac::EBTStatus HeroAgent::_Execute_Method_<METHOD_TYPE_HeroAgent_DoFlyToMasterAround>()
|
||||
{
|
||||
return this->HeroAgent::FlyToMasterAround();
|
||||
return this->HeroAgent::DoFlyToMasterAround();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_HeroAgent_FollowMaster { };
|
||||
template<> inline behaviac::EBTStatus HeroAgent::_Execute_Method_<METHOD_TYPE_HeroAgent_FollowMaster>()
|
||||
struct METHOD_TYPE_HeroAgent_DoFollowMaster { };
|
||||
template<> inline behaviac::EBTStatus HeroAgent::_Execute_Method_<METHOD_TYPE_HeroAgent_DoFollowMaster>()
|
||||
{
|
||||
return this->HeroAgent::FollowMaster();
|
||||
return this->HeroAgent::DoFollowMaster();
|
||||
}
|
||||
|
||||
|
||||
|
@ -237,7 +237,7 @@ namespace behaviac
|
||||
|
||||
virtual bool load()
|
||||
{
|
||||
AgentMeta::SetTotalSignature(1153590554u);
|
||||
AgentMeta::SetTotalSignature(1068415381u);
|
||||
|
||||
AgentMeta* meta = NULL;
|
||||
BEHAVIAC_UNUSED_VAR(meta);
|
||||
@ -293,17 +293,17 @@ namespace behaviac
|
||||
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
|
||||
|
||||
// HeroAgent
|
||||
meta = BEHAVIAC_NEW AgentMeta(3034510267u);
|
||||
meta = BEHAVIAC_NEW AgentMeta(3134647706u);
|
||||
AgentMeta::GetAgentMetas()[2270112014u] = meta;
|
||||
meta->RegisterMethod(623091365u, BEHAVIAC_NEW CAgentMethod_1< behaviac::EBTStatus, int >(FunctionPointer_HeroAgent_CoAttackTarget));
|
||||
meta->RegisterMethod(2886181657u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_HeroAgent_DoAttack));
|
||||
meta->RegisterMethod(542584570u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_HeroAgent_DoFlyToMasterAround));
|
||||
meta->RegisterMethod(1239418881u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_HeroAgent_DoFollowMaster));
|
||||
meta->RegisterMethod(2719091146u, BEHAVIAC_NEW CAgentMethod_1< behaviac::EBTStatus, int >(FunctionPointer_HeroAgent_DoHelpAttack));
|
||||
meta->RegisterMethod(2062982811u, BEHAVIAC_NEW CAgentMethod_2< EBTStatus, int, int >(FunctionPointer_HeroAgent_DoIdle));
|
||||
meta->RegisterMethod(846782702u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_HeroAgent_DoPursuit));
|
||||
meta->RegisterMethod(1079343198u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_HeroAgent_DoRandomShot));
|
||||
meta->RegisterMethod(130097619u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_HeroAgent_DoRandomWalk));
|
||||
meta->RegisterMethod(4119944363u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_HeroAgent_FlyToMasterAround));
|
||||
meta->RegisterMethod(3850832265u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_HeroAgent_FollowMaster));
|
||||
meta->RegisterMethod(32551668u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_HeroAgent_GetAttackRange));
|
||||
meta->RegisterMethod(3721974980u, BEHAVIAC_NEW CAgentMethod< float >(FunctionPointer_HeroAgent_GetMasterDistance));
|
||||
meta->RegisterMethod(3603629747u, BEHAVIAC_NEW CAgentMethod_1< bool, int >(FunctionPointer_HeroAgent_HasBuffEffect));
|
||||
|
@ -40,13 +40,13 @@ namespace behaviac
|
||||
inline void FunctionPointer_AndroidAgent_SetBulletTraceMode(Agent* self, bool mode) { ((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_SetBulletTraceMode, void, bool >(mode); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_CoAttackTarget(Agent* self, int target_id) { return ((HeroAgent*)self)->CoAttackTarget(target_id); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_DoAttack(Agent* self) { return (behaviac::EBTStatus)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_DoAttack, behaviac::EBTStatus >(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_DoFlyToMasterAround(Agent* self) { return (behaviac::EBTStatus)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_DoFlyToMasterAround, behaviac::EBTStatus >(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_DoFollowMaster(Agent* self) { return (behaviac::EBTStatus)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_DoFollowMaster, behaviac::EBTStatus >(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_DoHelpAttack(Agent* self, int target_uniid) { return ((HeroAgent*)self)->DoHelpAttack(target_uniid); }
|
||||
inline EBTStatus FunctionPointer_HeroAgent_DoIdle(Agent* self, int min_time, int max_time) { return ((HeroAgent*)self)->DoIdle(min_time, max_time); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_DoPursuit(Agent* self) { return ((HeroAgent*)self)->DoPursuit(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_DoRandomShot(Agent* self) { return ((HeroAgent*)self)->DoRandomShot(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_DoRandomWalk(Agent* self) { return ((HeroAgent*)self)->DoRandomWalk(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_FlyToMasterAround(Agent* self) { return (behaviac::EBTStatus)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_FlyToMasterAround, behaviac::EBTStatus >(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_FollowMaster(Agent* self) { return (behaviac::EBTStatus)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_FollowMaster, behaviac::EBTStatus >(); }
|
||||
inline float FunctionPointer_HeroAgent_GetAttackRange(Agent* self) { return ((HeroAgent*)self)->GetAttackRange(); }
|
||||
inline float FunctionPointer_HeroAgent_GetMasterDistance(Agent* self) { return ((HeroAgent*)self)->GetMasterDistance(); }
|
||||
inline bool FunctionPointer_HeroAgent_HasBuffEffect(Agent* self, int buff_effect) { return (bool)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_HasBuffEffect, bool, int >(buff_effect); }
|
||||
|
@ -1,3 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<agents version="1" signature="1153590554" />
|
||||
<agents version="1" signature="1068415381" />
|
@ -376,6 +376,9 @@ behaviac::EBTStatus HeroAgent::DoPursuit()
|
||||
|
||||
behaviac::EBTStatus HeroAgent::DoHelpAttack(int target_uniid)
|
||||
{
|
||||
if (status_ == behaviac::BT_RUNNING) {
|
||||
return DoRunningCb();
|
||||
}
|
||||
Creature* enemy = GetOwner()->room->GetCreatureByUniId(target_uniid);
|
||||
if (!enemy) {
|
||||
return behaviac::BT_FAILURE;
|
||||
@ -447,7 +450,7 @@ behaviac::EBTStatus HeroAgent::DoHelpAttack(int target_uniid)
|
||||
);
|
||||
}
|
||||
|
||||
behaviac::EBTStatus HeroAgent::FlyToMasterAround()
|
||||
behaviac::EBTStatus HeroAgent::DoFlyToMasterAround()
|
||||
{
|
||||
if (!GetOwner()->AsHero()->master.Get()) {
|
||||
return behaviac::BT_FAILURE;
|
||||
@ -467,12 +470,54 @@ behaviac::EBTStatus HeroAgent::FlyToMasterAround()
|
||||
GetOwner()->GetMutablePos().FromGlmVec3(point);
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
GetOwner()->room->grid_service->MoveCreature(GetOwner());
|
||||
GetOwner()->SetAttackDir(GetOwner()->AsHero()->master.Get()->GetAttackDir());
|
||||
return behaviac::BT_SUCCESS;
|
||||
}
|
||||
|
||||
behaviac::EBTStatus HeroAgent::FollowMaster()
|
||||
behaviac::EBTStatus HeroAgent::DoFollowMaster()
|
||||
{
|
||||
if (status_ == behaviac::BT_RUNNING) {
|
||||
return DoRunningCb();
|
||||
}
|
||||
if (GetOwner()->AsHero()->master.Get()->dead) {
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
|
||||
long long last_frameno = GetOwner()->room->GetFrameNo();
|
||||
long long last_follow_frameno = GetOwner()->room->GetFrameNo();
|
||||
return StartCoroutine
|
||||
(
|
||||
[this, last_frameno, last_follow_frameno] () mutable
|
||||
{
|
||||
if (GetOwner()->room->GetFrameNo() - last_frameno > SERVER_FRAME_RATE * 10 ||
|
||||
!GetOwner()->AsHero()->master.Get() || GetOwner()->AsHero()->master.Get()->dead) {
|
||||
status_ = behaviac::BT_SUCCESS;
|
||||
return behaviac::BT_SUCCESS;
|
||||
} else {
|
||||
if (GlmHelper::IsEqual2D(GetOwner()->GetPos().ToGlmVec3(),
|
||||
GetOwner()->AsHero()->master.Get()->GetPos().ToGlmVec3())) {
|
||||
return behaviac::BT_SUCCESS;
|
||||
}
|
||||
glm::vec3 dir = GetOwner()->AsHero()->master.Get()->GetPos().CalcDir(GetOwner()->GetPos());
|
||||
if (GlmHelper::Norm(dir) < 60) {
|
||||
return behaviac::BT_SUCCESS;
|
||||
}
|
||||
if (GlmHelper::Norm(dir) > 60) {
|
||||
GlmHelper::Normalize(dir);
|
||||
GetOwner()->SetMoveDir(dir);
|
||||
GetOwner()->SetAttackDir(dir);
|
||||
GetOwner()->GetMovement()->CalcTargetPos(60);
|
||||
last_follow_frameno = GetOwner()->room->GetFrameNo();
|
||||
}
|
||||
return behaviac::BT_RUNNING;
|
||||
}
|
||||
},
|
||||
[this] (bool is_test, bool& has_event)
|
||||
{
|
||||
|
||||
},
|
||||
"CoFollowMaster"
|
||||
);
|
||||
}
|
||||
|
||||
float HeroAgent::GetMasterDistance()
|
||||
|
@ -20,8 +20,8 @@ public:
|
||||
behaviac::EBTStatus DoAttack();
|
||||
behaviac::EBTStatus DoPursuit();
|
||||
behaviac::EBTStatus DoHelpAttack(int target_uniid);
|
||||
behaviac::EBTStatus FlyToMasterAround();
|
||||
behaviac::EBTStatus FollowMaster();
|
||||
behaviac::EBTStatus DoFlyToMasterAround();
|
||||
behaviac::EBTStatus DoFollowMaster();
|
||||
float GetMasterDistance();
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user