1
This commit is contained in:
parent
ab8db13131
commit
e5f524d1c8
@ -16,12 +16,6 @@
|
|||||||
|
|
||||||
#include "mt/Robot.h"
|
#include "mt/Robot.h"
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
static auto SpToWp(std::shared_ptr<T> sp)
|
|
||||||
{
|
|
||||||
return std::weak_ptr<T>(sp);
|
|
||||||
}
|
|
||||||
|
|
||||||
AndroidAgent::AndroidAgent():BaseAgent()
|
AndroidAgent::AndroidAgent():BaseAgent()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -67,7 +61,7 @@ behaviac::EBTStatus AndroidAgent::DoRandomWalk()
|
|||||||
GetOwner()->GetTrigger()->AddListener
|
GetOwner()->GetTrigger()->AddListener
|
||||||
(
|
(
|
||||||
kAttacked,
|
kAttacked,
|
||||||
[context_wp = SpToWp(context)] (const a8::Args& args)
|
[context_wp = a8::SpToWp(context)] (const a8::Args& args)
|
||||||
{
|
{
|
||||||
if (!context_wp.expired()) {
|
if (!context_wp.expired()) {
|
||||||
auto context = context_wp.lock();
|
auto context = context_wp.lock();
|
||||||
|
@ -19,12 +19,6 @@
|
|||||||
#include "mt/Hero.h"
|
#include "mt/Hero.h"
|
||||||
#include "mt/Param.h"
|
#include "mt/Param.h"
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
static auto SpToWp(std::shared_ptr<T> sp)
|
|
||||||
{
|
|
||||||
return std::weak_ptr<T>(sp);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DumpBt(BaseAgent* agent)
|
void DumpBt(BaseAgent* agent)
|
||||||
{
|
{
|
||||||
static std::string last_bt_name;
|
static std::string last_bt_name;
|
||||||
@ -264,7 +258,7 @@ behaviac::EBTStatus BaseAgent::DoIdle(int min_time, int max_time)
|
|||||||
GetOwner()->GetTrigger()->AddListener
|
GetOwner()->GetTrigger()->AddListener
|
||||||
(
|
(
|
||||||
kAttacked,
|
kAttacked,
|
||||||
[context_wp = SpToWp(context)] (const a8::Args& args)
|
[context_wp = a8::SpToWp(context)] (const a8::Args& args)
|
||||||
{
|
{
|
||||||
if (!context_wp.expired()) {
|
if (!context_wp.expired()) {
|
||||||
auto context = context_wp.lock();
|
auto context = context_wp.lock();
|
||||||
|
@ -18,6 +18,15 @@ context->owner = owner; \
|
|||||||
return context; \
|
return context; \
|
||||||
}(GetOwner()->GetWeakPtrRef(), this)
|
}(GetOwner()->GetWeakPtrRef(), this)
|
||||||
|
|
||||||
|
namespace a8
|
||||||
|
{
|
||||||
|
template<typename T>
|
||||||
|
static auto SpToWp(std::shared_ptr<T> sp)
|
||||||
|
{
|
||||||
|
return std::weak_ptr<T>(sp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
struct BtCoroutine;
|
struct BtCoroutine;
|
||||||
class Creature;
|
class Creature;
|
||||||
class BaseAgent : public behaviac::Agent
|
class BaseAgent : public behaviac::Agent
|
||||||
|
@ -18,12 +18,6 @@
|
|||||||
#include "mt/Map.h"
|
#include "mt/Map.h"
|
||||||
#include "mt/Hero.h"
|
#include "mt/Hero.h"
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
static auto SpToWp(std::shared_ptr<T> sp)
|
|
||||||
{
|
|
||||||
return std::weak_ptr<T>(sp);
|
|
||||||
}
|
|
||||||
|
|
||||||
HeroAgent::HeroAgent():BaseAgent()
|
HeroAgent::HeroAgent():BaseAgent()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user