1
This commit is contained in:
parent
9d85c832d5
commit
5bcc347518
@ -318,6 +318,28 @@ behaviac::EBTStatus HeroAgent::CoIdle(int min_val, int max_val)
|
|||||||
if (status_ == behaviac::BT_RUNNING) {
|
if (status_ == behaviac::BT_RUNNING) {
|
||||||
return DoRunningCb();
|
return DoRunningCb();
|
||||||
}
|
}
|
||||||
|
auto context = MAKE_BTCONTEXT
|
||||||
|
(
|
||||||
|
a8::XTimerWp timer_ptr;
|
||||||
|
);
|
||||||
|
context->timer_ptr = owner_->room->xtimer.SetTimeoutWpEx
|
||||||
|
(
|
||||||
|
a8::RandEx(min_val, max_val) / FRAME_RATE_MS,
|
||||||
|
[] (int event, const a8::Args* args)
|
||||||
|
{
|
||||||
|
},
|
||||||
|
&owner_->xtimer_attacher);
|
||||||
|
auto co = std::make_shared<BtCoroutine>(context, "CoIdle");
|
||||||
|
co->runing_cb =
|
||||||
|
[this, context] ()
|
||||||
|
{
|
||||||
|
if (!context->timer_ptr.expired()) {
|
||||||
|
return behaviac::BT_RUNNING;
|
||||||
|
} else {
|
||||||
|
return behaviac::BT_SUCCESS;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return StartCoroutine(co);
|
||||||
}
|
}
|
||||||
|
|
||||||
behaviac::EBTStatus HeroAgent::CoMoveCurrentTargetRaycast()
|
behaviac::EBTStatus HeroAgent::CoMoveCurrentTargetRaycast()
|
||||||
|
@ -14,7 +14,7 @@ class Context : public BtContext \
|
|||||||
auto context = std::make_shared<Context>(); \
|
auto context = std::make_shared<Context>(); \
|
||||||
context->SetOwner(owner); \
|
context->SetOwner(owner); \
|
||||||
return context; \
|
return context; \
|
||||||
}(GetOwner()->GetWeakPtrRef(), this)
|
}(owner_->GetWeakPtrRef(), this)
|
||||||
|
|
||||||
namespace a8
|
namespace a8
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user