1
This commit is contained in:
parent
f66025ad4e
commit
7f49358f6f
@ -1,8 +1,5 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#ifdef NEW_BT
|
||||
#else
|
||||
|
||||
#include "btcontext.h"
|
||||
#include "creature.h"
|
||||
#include "trigger.h"
|
||||
@ -46,4 +43,3 @@ void BtContext::FireEvent(BaseAgent* agent)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
class HeroAgent;
|
||||
class BaseAgent;
|
||||
class BtEvent;
|
||||
struct EventHandlerPtr;
|
||||
|
@ -1,12 +1,10 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#ifdef NEW_BT
|
||||
#else
|
||||
|
||||
#include "btevent.h"
|
||||
#include "creature.h"
|
||||
#include "trigger.h"
|
||||
#include "base_agent.h"
|
||||
#include "new_base_agent.h"
|
||||
|
||||
std::shared_ptr<BtEvent> BtEvent::Create(int event_id,
|
||||
a8::Args event_params,
|
||||
@ -42,4 +40,3 @@ void BtEvent::FireEvent(BaseAgent* agent)
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -6,6 +6,7 @@ enum BtEventType_e
|
||||
kBetOnCrazeMode,
|
||||
};
|
||||
|
||||
class HeroAgent;
|
||||
class BaseAgent;
|
||||
class BtEvent
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <f8/btmgr.h>
|
||||
|
||||
#include "new_hero_agent.h"
|
||||
|
||||
#include "hero.h"
|
||||
@ -12,6 +14,8 @@
|
||||
#include "mapinstance.h"
|
||||
#include "collision.h"
|
||||
#include "human.h"
|
||||
#include "btcoroutine.h"
|
||||
#include "btcontext.h"
|
||||
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/Equip.h"
|
||||
@ -27,7 +31,15 @@ HeroAgent::~HeroAgent()
|
||||
|
||||
void HeroAgent::Exec()
|
||||
{
|
||||
|
||||
behaviac::EBTStatus status = f8::BtMgr::Instance()->BtExec(this);
|
||||
if (status == behaviac::BT_RUNNING && coroutine_ && coroutine_->GetContext()->HasEvent()) {
|
||||
status_= behaviac::BT_INVALID;
|
||||
auto old_coroutine = coroutine_;
|
||||
coroutine_ = nullptr;
|
||||
owner_->shot_hold = false;
|
||||
old_coroutine->GetContext()->FireEvent(this);
|
||||
old_coroutine = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void HeroAgent::SetOwner(Creature* owner)
|
||||
@ -239,7 +251,7 @@ int HeroAgent::IncV(int id, int val)
|
||||
|
||||
int HeroAgent::DecV(int id, int val)
|
||||
{
|
||||
IncV(id, -val);
|
||||
return IncV(id, -val);
|
||||
}
|
||||
|
||||
bool HeroAgent::HasBuffEffect(int effect_id)
|
||||
|
@ -6,6 +6,7 @@ class Hero;
|
||||
class RoomAgent;
|
||||
class TeamAgent;
|
||||
class TargetAgent;
|
||||
class BtCoroutine;
|
||||
class HeroAgent : public BaseAgent
|
||||
{
|
||||
public:
|
||||
@ -103,4 +104,13 @@ private:
|
||||
bool bullet_trace_mode_ = false;
|
||||
long long flags_ = 0;
|
||||
std::map<int, int> dyn_hash_;
|
||||
|
||||
#ifdef DEBUG
|
||||
behaviac::EBTStatus last_status_ = behaviac::BT_INVALID;
|
||||
long long status_frameno_ = 0;
|
||||
const char* status_name_ = nullptr;
|
||||
#endif
|
||||
behaviac::EBTStatus status_= behaviac::BT_SUCCESS;
|
||||
std::shared_ptr<BtCoroutine> coroutine_;
|
||||
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user