This commit is contained in:
aozhiwei 2023-04-05 15:37:47 +08:00
parent 1eeb8300b4
commit 8268c1519b

View File

@ -60,10 +60,10 @@ void BaseAgent::Exec()
coroutine_->event_cb(true, has_event); coroutine_->event_cb(true, has_event);
if (has_event) { if (has_event) {
status_= behaviac::BT_INVALID; status_= behaviac::BT_INVALID;
coroutine_->runing_cb = nullptr; auto old_coroutine = coroutine_;
coroutine_->event_cb(false, has_event);
coroutine_->event_cb = nullptr;
coroutine_ = nullptr; coroutine_ = nullptr;
old_coroutine->event_cb(false, has_event);
old_coroutine = nullptr;
#ifdef DEBUG1 #ifdef DEBUG1
a8::XPrintf("FireEvent OnAttacked\n", {}); a8::XPrintf("FireEvent OnAttacked\n", {});
#endif #endif
@ -100,7 +100,7 @@ behaviac::EBTStatus BaseAgent::StartCoroutine(std::shared_ptr<BtCoroutine> corou
{ {
coroutine_ = coroutine; coroutine_ = coroutine;
#ifdef DEBUG #ifdef DEBUG
last_status_ = behaviac::BT_INVALID;d last_status_ = behaviac::BT_INVALID;
status_frameno_ = GetOwner()->room->GetFrameNo(); status_frameno_ = GetOwner()->room->GetFrameNo();
status_name_ = coroutine_->name; status_name_ = coroutine_->name;
#endif #endif
@ -270,4 +270,3 @@ behaviac::EBTStatus BaseAgent::DoIdle(int min_time, int max_time)
}; };
return StartCoroutine(co); return StartCoroutine(co);
} }
>