1
This commit is contained in:
parent
53d0553d40
commit
07e56b7e59
@ -109,7 +109,7 @@ behaviac::EBTStatus BaseAgent::StartCoroutine(std::shared_ptr<BtCoroutine> corou
|
||||
#ifdef DEBUG
|
||||
last_status_ = behaviac::BT_INVALID;
|
||||
status_frameno_ = GetOwner()->room->GetFrameNo();
|
||||
status_name_ = coroutine_->name;
|
||||
status_name_ = coroutine_->GetName();
|
||||
#endif
|
||||
status_ = behaviac::BT_RUNNING;
|
||||
return status_;
|
||||
|
@ -27,7 +27,7 @@ namespace a8
|
||||
}
|
||||
}
|
||||
|
||||
struct BtCoroutine;
|
||||
class BtCoroutine;
|
||||
class Creature;
|
||||
class BaseAgent : public behaviac::Agent
|
||||
{
|
||||
|
@ -9,8 +9,8 @@
|
||||
|
||||
bool BtCoroutine::HasEvent()
|
||||
{
|
||||
if (!context->events.empty()) {
|
||||
auto event = context->events.at(context->events.size() - 1);
|
||||
if (!context_->events.empty()) {
|
||||
auto event = context_->events.at(context_->events.size() - 1);
|
||||
return event->HasEvent();
|
||||
}
|
||||
return false;
|
||||
@ -18,8 +18,8 @@ bool BtCoroutine::HasEvent()
|
||||
|
||||
void BtCoroutine::FireEvent(BaseAgent* agent)
|
||||
{
|
||||
if (!context->events.empty()) {
|
||||
auto event = context->events.at(context->events.size() - 1);
|
||||
if (!context_->events.empty()) {
|
||||
auto event = context_->events.at(context_->events.size() - 1);
|
||||
if (event->HasEvent()) {
|
||||
event->FireEvent(agent);
|
||||
}
|
||||
|
@ -5,20 +5,26 @@
|
||||
|
||||
struct BtContext;
|
||||
class BaseAgent;
|
||||
struct BtCoroutine
|
||||
class BtCoroutine
|
||||
{
|
||||
std::shared_ptr<BtContext> context;
|
||||
const char* name = nullptr;
|
||||
public:
|
||||
|
||||
std::function<behaviac::EBTStatus()> runing_cb;
|
||||
long long sleep_end_frameno = 0;
|
||||
int sleep_time = 0;
|
||||
|
||||
BtCoroutine(std::shared_ptr<BtContext> context, const char* name)
|
||||
{
|
||||
this->context = context;
|
||||
this->name = name;
|
||||
this->context_ = context;
|
||||
this->name_ = name;
|
||||
}
|
||||
|
||||
bool HasEvent();
|
||||
void FireEvent(BaseAgent* agent);
|
||||
const char* GetName() const { return name_; }
|
||||
|
||||
private:
|
||||
std::shared_ptr<BtContext> context_;
|
||||
const char* name_ = nullptr;
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user