1
This commit is contained in:
parent
d19d911ce8
commit
49c41672e4
@ -1283,5 +1283,28 @@ void HeroAgent::AbandonPickup(int min_time, int max_time)
|
||||
|
||||
behaviac::EBTStatus HeroAgent::Pickup()
|
||||
{
|
||||
|
||||
PRE_ENTER_COROUTINE();
|
||||
auto context = MAKE_BTCONTEXT
|
||||
(
|
||||
);
|
||||
int pickup_time = a8::RandEx(500 + 1000 * 3);
|
||||
auto co = std::make_shared<BtCoroutine>(context, co_id, "Pickup");
|
||||
co->runing_cb =
|
||||
[this, context] (BtCoroutine* co)
|
||||
{
|
||||
if (co->IsAbort()) {
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
if (owner_->dead) {
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
if (!PickupObjIsValid()) {
|
||||
return behaviac::BT_FAILURE;
|
||||
}
|
||||
if ((GetRoom()->GetFrameNo() - context->frameno) * FRAME_RATE_MS < pickup_time) {
|
||||
return behaviac::BT_RUNNING;
|
||||
}
|
||||
return behaviac::BT_SUCCESS;
|
||||
};
|
||||
return StartCoroutine(co);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user