1
This commit is contained in:
parent
321765334f
commit
b79c58cf30
@ -23,11 +23,13 @@
|
||||
|
||||
HeroAgent::HeroAgent():BaseAgent()
|
||||
{
|
||||
|
||||
current_target_agent = behaviac::Agent::Create<TargetAgent>();
|
||||
}
|
||||
|
||||
HeroAgent::~HeroAgent()
|
||||
{
|
||||
f8::BtMgr::Instance()->BtDestory(current_target_agent);
|
||||
current_target_agent = nullptr;
|
||||
}
|
||||
|
||||
void HeroAgent::Exec()
|
||||
@ -48,6 +50,7 @@ void HeroAgent::Exec()
|
||||
void HeroAgent::SetOwner(Creature* owner)
|
||||
{
|
||||
owner_ = owner;
|
||||
current_target_agent->SetOwner(owner_);
|
||||
room_agent = owner_->room->GetRoomAgent();
|
||||
team_agent = owner_->GetTeam()->GetTeamAgent();
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public:
|
||||
|
||||
bool IsGameOver();
|
||||
void SetRoom(Room* room) { room_ = room; }
|
||||
virtual Room* GetRoom() { return room_; }
|
||||
virtual Room* GetRoom() override { return room_; }
|
||||
|
||||
private:
|
||||
Room* room_ = nullptr;
|
||||
|
@ -75,3 +75,13 @@ void TargetAgent::Abandon()
|
||||
{
|
||||
target_.Reset();
|
||||
}
|
||||
|
||||
void TargetAgent::SetOwner(Creature* owner)
|
||||
{
|
||||
owner_ = owner;
|
||||
}
|
||||
|
||||
Room* TargetAgent::GetRoom()
|
||||
{
|
||||
return owner_->room;
|
||||
}
|
||||
|
@ -23,6 +23,10 @@ public:
|
||||
int GetLevel();
|
||||
void Abandon();
|
||||
|
||||
void SetOwner(Creature* owner);
|
||||
virtual Room* GetRoom() override;
|
||||
|
||||
private:
|
||||
CreatureWeakPtr target_;
|
||||
Creature* owner_ = nullptr;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user