1
This commit is contained in:
parent
3099fa99bc
commit
d1772dd4b7
@ -176,15 +176,16 @@ behaviac::EBTStatus AndroidAgent::DoPursuit()
|
|||||||
last_pursuit_frameno = GetOwner()->room->GetFrameNo();
|
last_pursuit_frameno = GetOwner()->room->GetFrameNo();
|
||||||
} else {
|
} else {
|
||||||
bool is_shot = false;
|
bool is_shot = false;
|
||||||
dir.Normalize();
|
if (dir.Norm() > 300) {
|
||||||
if (dir.Norm() > 500) {
|
|
||||||
if (GetOwner()->GetMoveHelper()->GetPathSize() < 1) {
|
if (GetOwner()->GetMoveHelper()->GetPathSize() < 1) {
|
||||||
|
dir.Normalize();
|
||||||
GetOwner()->SetMoveDir(dir);
|
GetOwner()->SetMoveDir(dir);
|
||||||
GetOwner()->SetAttackDir(dir);
|
GetOwner()->SetAttackDir(dir);
|
||||||
GetOwner()->GetMoveHelper()->CalcTargetPos(200);
|
GetOwner()->GetMoveHelper()->CalcTargetPos(200);
|
||||||
last_pursuit_frameno = GetOwner()->room->GetFrameNo();
|
last_pursuit_frameno = GetOwner()->room->GetFrameNo();
|
||||||
} else {
|
} else {
|
||||||
if (GetOwner()->room->GetFrameNo() - last_pursuit_frameno > SERVER_FRAME_RATE * 1) {
|
if (GetOwner()->room->GetFrameNo() - last_pursuit_frameno > SERVER_FRAME_RATE * 1) {
|
||||||
|
dir.Normalize();
|
||||||
GetOwner()->SetMoveDir(dir);
|
GetOwner()->SetMoveDir(dir);
|
||||||
GetOwner()->SetAttackDir(dir);
|
GetOwner()->SetAttackDir(dir);
|
||||||
GetOwner()->GetMoveHelper()->CalcTargetPos(200);
|
GetOwner()->GetMoveHelper()->CalcTargetPos(200);
|
||||||
@ -192,6 +193,7 @@ behaviac::EBTStatus AndroidAgent::DoPursuit()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
dir.Normalize();
|
||||||
is_shot = true;
|
is_shot = true;
|
||||||
}
|
}
|
||||||
if (is_shot) {
|
if (is_shot) {
|
||||||
|
@ -236,7 +236,7 @@ void MoveHelper::AddPaths(const a8::Vec3& start, std::vector<a8::Vec3>& paths)
|
|||||||
last_pos.x = paths[i].x;
|
last_pos.x = paths[i].x;
|
||||||
last_pos.y = paths[i].y;
|
last_pos.y = paths[i].y;
|
||||||
last_pos.z = paths[i].z;
|
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",
|
a8::XPrintf("AddPaths size:%d i:%d src_pos:%f,%f tar_pos:%f:%f\n",
|
||||||
{
|
{
|
||||||
paths.size(),
|
paths.size(),
|
||||||
|
@ -423,9 +423,9 @@ Human* Room::FindEnemy(Human* hum, float range)
|
|||||||
a8::XParams(),
|
a8::XParams(),
|
||||||
[&target, myself, range, &last_distance] (Human* hum, a8::XParams& param)
|
[&target, myself, range, &last_distance] (Human* hum, a8::XParams& param)
|
||||||
{
|
{
|
||||||
if (!target->dead &&
|
if (!hum->dead &&
|
||||||
hum->team_id != myself->team_id) {
|
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 <= range) {
|
||||||
if (distance < last_distance) {
|
if (distance < last_distance) {
|
||||||
target = hum;
|
target = hum;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user