1
This commit is contained in:
parent
bd56f2c193
commit
5b36619f6a
@ -35,15 +35,17 @@ behaviac::EBTStatus AndroidAgent::DoIdle(int min_time, int max_time)
|
|||||||
&GetOwner()->xtimer_attacher.timer_list_);
|
&GetOwner()->xtimer_attacher.timer_list_);
|
||||||
std::weak_ptr<a8::XTimerPtr> timer_ptr = GetOwner()->room->xtimer.GetTimerPtr(timer);
|
std::weak_ptr<a8::XTimerPtr> timer_ptr = GetOwner()->room->xtimer.GetTimerPtr(timer);
|
||||||
status_runing_cb_ =
|
status_runing_cb_ =
|
||||||
[timer_ptr] ()
|
[this, timer_ptr] ()
|
||||||
{
|
{
|
||||||
if (timer_ptr.lock()) {
|
if (timer_ptr.lock()) {
|
||||||
return behaviac::BT_RUNNING;
|
return behaviac::BT_RUNNING;
|
||||||
} else {
|
} else {
|
||||||
|
status_ = behaviac::BT_SUCCESS;
|
||||||
return behaviac::BT_SUCCESS;
|
return behaviac::BT_SUCCESS;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return behaviac::BT_RUNNING;
|
status_ = behaviac::BT_RUNNING;
|
||||||
|
return status_;
|
||||||
}
|
}
|
||||||
|
|
||||||
behaviac::EBTStatus AndroidAgent::DoRandomWalk()
|
behaviac::EBTStatus AndroidAgent::DoRandomWalk()
|
||||||
@ -56,12 +58,21 @@ behaviac::EBTStatus AndroidAgent::DoRandomWalk()
|
|||||||
dir.Rotate((10 + rand() % 360)/ 180.0f);
|
dir.Rotate((10 + rand() % 360)/ 180.0f);
|
||||||
dir.Normalize();
|
dir.Normalize();
|
||||||
GetOwner()->GetMoveHelper()->CalcTargetPos(500);
|
GetOwner()->GetMoveHelper()->CalcTargetPos(500);
|
||||||
|
if (GetOwner()->GetMoveHelper()->GetPathSize() <= 0) {
|
||||||
|
return behaviac::BT_FAILURE;
|
||||||
|
}
|
||||||
status_runing_cb_ =
|
status_runing_cb_ =
|
||||||
[] ()
|
[this] ()
|
||||||
{
|
{
|
||||||
return behaviac::BT_SUCCESS;
|
if (GetOwner()->GetMoveHelper()->GetPathSize() <= 0) {
|
||||||
|
status_ = behaviac::BT_SUCCESS;
|
||||||
|
return behaviac::BT_SUCCESS;
|
||||||
|
} else {
|
||||||
|
return behaviac::BT_RUNNING;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
return behaviac::BT_SUCCESS;
|
status_ = behaviac::BT_RUNNING;
|
||||||
|
return status_;
|
||||||
}
|
}
|
||||||
|
|
||||||
behaviac::EBTStatus AndroidAgent::DoRandomShot()
|
behaviac::EBTStatus AndroidAgent::DoRandomShot()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user