This commit is contained in:
aozhiwei 2023-06-23 19:21:51 +08:00
parent ed4b8b09aa
commit 53d0553d40
5 changed files with 4 additions and 5 deletions

View File

@ -50,7 +50,7 @@ behaviac::EBTStatus AndroidAgent::DoRandomShot()
GetOwner()->GetTrigger()->AddListener
(
kAttacked,
[context_wp = context->GetWp()] (const a8::Args& args)
[context_wp = a8::SpToWp(context)] (const a8::Args& args)
{
if (!context_wp.expired()) {
auto context = context_wp.lock();

View File

@ -54,7 +54,7 @@ behaviac::EBTStatus HeroAgent::DoAttack()
GetOwner()->AsHero()->master.Get()->GetTrigger()->AddListener
(
kBulletHitEvent,
[context_wp = context->GetWp()] (const a8::Args& args)
[context_wp = a8::SpToWp(context)] (const a8::Args& args)
{
if (!context_wp.expired()) {
auto context = context_wp.lock();

View File

@ -37,7 +37,7 @@ behaviac::EBTStatus HeroAgent::DoRandomShot()
GetOwner()->GetTrigger()->AddListener
(
kAttacked,
[context_wp = context->GetWp()] (const a8::Args& args)
[context_wp = a8::SpToWp(context)] (const a8::Args& args)
{
if (!context_wp.expired()) {
auto context = context_wp.lock();

View File

@ -36,7 +36,7 @@ behaviac::EBTStatus HeroAgent::DoRandomWalk()
GetOwner()->GetTrigger()->AddListener
(
kAttacked,
[context_wp = context->GetWp()] (const a8::Args& args)
[context_wp = a8::SpToWp(context)] (const a8::Args& args)
{
if (!context_wp.expired()) {
auto context = context_wp.lock();

View File

@ -13,7 +13,6 @@ public:
virtual ~BtContext();
void AddHandler(CreatureWeakPtr target, std::weak_ptr<EventHandlerPtr> handler);
std::weak_ptr<BtContext> GetWp() { return shared_from_this();};
private:
};