This commit is contained in:
aozhiwei 2022-12-06 16:24:38 +08:00
parent 09d724202a
commit d4eb937be5
4 changed files with 24 additions and 7 deletions

View File

@ -91,13 +91,22 @@ void Android::InternalUpdate(int delta_time)
if (GetMoveHelper()->GetPathSize() > 0) { if (GetMoveHelper()->GetPathSize() > 0) {
Global::Instance()->verify_set_pos = 1; Global::Instance()->verify_set_pos = 1;
int speed = std::max(1, (int)GetSpeed()) * 1; int speed = std::max(1, (int)GetSpeed()) * 1;
a8::Vec2 old_pos = GetPos();
_UpdateMove(speed); _UpdateMove(speed);
#ifdef DEBUG1
a8::XPrintf("updatemove old_pos:%f,%f new_pos:%f,%f\n",
{
old_pos.x,
old_pos.y,
GetPos().x,
GetPos().y,
});
#endif
Global::Instance()->verify_set_pos = 0; Global::Instance()->verify_set_pos = 0;
} }
behaviac::EBTStatus status = f8::BtMgr::Instance()->BtExec(agent_); behaviac::EBTStatus status = f8::BtMgr::Instance()->BtExec(agent_);
#if 0 #ifdef DEBUG
if (status != behaviac::BT_RUNNING) { {
abort();
} }
#endif #endif
} }

View File

@ -62,7 +62,9 @@ behaviac::EBTStatus AndroidAgent::DoRandomWalk()
a8::Vec2 dir = GetOwner()->GetMoveDir(); a8::Vec2 dir = GetOwner()->GetMoveDir();
dir.Rotate((10 + rand() % 360)/ 180.0f); dir.Rotate((10 + rand() % 360)/ 180.0f);
dir.Normalize(); dir.Normalize();
GetOwner()->GetMoveHelper()->CalcTargetPos(500); GetOwner()->SetMoveDir(dir);
GetOwner()->SetAttackDir(dir);
GetOwner()->GetMoveHelper()->CalcTargetPos(200);
if (GetOwner()->GetMoveHelper()->GetPathSize() <= 0) { if (GetOwner()->GetMoveHelper()->GetPathSize() <= 0) {
return behaviac::BT_FAILURE; return behaviac::BT_FAILURE;
} }

View File

@ -231,6 +231,9 @@ bool App::Init(int argc, char* argv[])
f8::TGLog::Instance()->Init(a8::Format(PROJ_NAME_FMT, {GAME_ID}), false, 0); f8::TGLog::Instance()->Init(a8::Format(PROJ_NAME_FMT, {GAME_ID}), false, 0);
f8::HttpClientPool::Instance()->Init(MAX_ALL_HTTP_NUM, MAX_SYS_HTTP_NUM, MAX_USER_HTTP_NUM); f8::HttpClientPool::Instance()->Init(MAX_ALL_HTTP_NUM, MAX_SYS_HTTP_NUM, MAX_USER_HTTP_NUM);
f8::BtMgr::Instance()->Init("exported"); f8::BtMgr::Instance()->Init("exported");
#ifdef DEBUG
f8::BtMgr::Instance()->SetLogging(true);
#endif
SkillHelper::Init(); SkillHelper::Init();
JsonDataMgr::Instance()->Init(); JsonDataMgr::Instance()->Init();
MetaMgr::Instance()->Init(); MetaMgr::Instance()->Init();

View File

@ -70,6 +70,8 @@ bool MoveHelper::GetMovePosition(glm::vec3& out_pos)
abort(); abort();
} }
return true; return true;
} else {
ClearPath();
} }
return false; return false;
} }
@ -136,8 +138,8 @@ void MoveHelper::CalcTargetPos(float distance)
point->tar_pos.z < 0) { point->tar_pos.z < 0) {
abort(); abort();
} }
#ifdef DEBUG1 #ifdef DEBUG
a8::XPrintf("CalcTargetPos src_pos:%f,%f tar_pos:%f,%f is_hit:%d start:%f,%f,%f end:%f,%f,%f\n", a8::XPrintf("CalcTargetPos src_pos:%f,%f tar_pos:%f,%f is_hit:%d start:%f,%f,%f end:%f,%f,%f distance:%f\n",
{ {
point->src_pos.x, point->src_pos.x,
point->src_pos.z, point->src_pos.z,
@ -151,7 +153,8 @@ void MoveHelper::CalcTargetPos(float distance)
end.x, end.x,
end.y, end.y,
end.z end.z,
point->distance
}); });
#endif #endif