36 lines
864 B
C++
36 lines
864 B
C++
#pragma once
|
|
|
|
#include "behaviac/behaviac.h"
|
|
//#include "behaviac_customized_types.h"
|
|
|
|
class BtContext;
|
|
class BaseAgent;
|
|
class BtCoroutine
|
|
{
|
|
public:
|
|
|
|
std::function<behaviac::EBTStatus(BtCoroutine*)> runing_cb;
|
|
long long sleep_end_frameno = 0;
|
|
int sleep_time = 0;
|
|
list_head entry;
|
|
long long abort_exec_times = 0;
|
|
long long abort_frameno = 0;
|
|
behaviac::EBTStatus status = behaviac::BT_RUNNING;
|
|
|
|
BtCoroutine(std::shared_ptr<BtContext> context, int id, const char* name);
|
|
virtual ~BtCoroutine();
|
|
|
|
const char* GetName() const { return name_; }
|
|
auto GetContext() { return context_; }
|
|
int GetId() { return id_; }
|
|
bool IsAbort() { return is_abort_; }
|
|
void Abort(long long frameno);
|
|
|
|
private:
|
|
std::shared_ptr<BtContext> context_;
|
|
const char* name_ = nullptr;
|
|
int id_ = 0;
|
|
bool is_abort_ = false;
|
|
|
|
};
|