1
This commit is contained in:
parent
8f31bb8f2a
commit
40bf09f833
@ -18,6 +18,7 @@
|
||||
#include "btcontext.h"
|
||||
#include "team.h"
|
||||
#include "master_agent.h"
|
||||
#include "team_agent.h"
|
||||
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/Equip.h"
|
||||
@ -26,6 +27,7 @@ HeroAgent::HeroAgent():BaseAgent()
|
||||
{
|
||||
current_target_agent = behaviac::Agent::Create<TargetAgent>();
|
||||
master_agent = behaviac::Agent::Create<MasterAgent>();
|
||||
team_agent = behaviac::Agent::Create<TeamAgent>();
|
||||
}
|
||||
|
||||
HeroAgent::~HeroAgent()
|
||||
@ -38,6 +40,10 @@ HeroAgent::~HeroAgent()
|
||||
f8::BtMgr::Instance()->BtDestory(master_agent);
|
||||
master_agent = nullptr;
|
||||
}
|
||||
{
|
||||
f8::BtMgr::Instance()->BtDestory(team_agent);
|
||||
team_agent = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void HeroAgent::Exec()
|
||||
@ -60,8 +66,7 @@ void HeroAgent::SetOwner(Creature* owner)
|
||||
owner_ = owner;
|
||||
current_target_agent->SetOwner(owner_);
|
||||
room_agent = owner_->room->GetRoomAgent();
|
||||
team_agent = owner_->GetTeam()->GetTeamAgent();
|
||||
}
|
||||
}
|
||||
|
||||
int HeroAgent::GetUniId()
|
||||
{
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "jsondatamgr.h"
|
||||
#include "httpproxy.h"
|
||||
#include "roommgr.h"
|
||||
#include "team_agent.h"
|
||||
|
||||
#include "mt/Param.h"
|
||||
#include "mt/Map.h"
|
||||
@ -26,14 +25,10 @@
|
||||
|
||||
Team::Team()
|
||||
{
|
||||
team_agent_ = behaviac::Agent::Create<TeamAgent>();
|
||||
team_agent_->SetTeam(this);
|
||||
}
|
||||
|
||||
Team::~Team()
|
||||
{
|
||||
f8::BtMgr::Instance()->BtDestory(team_agent_);
|
||||
team_agent_ = nullptr;
|
||||
}
|
||||
|
||||
void Team::TraverseMembers(std::function<bool (Human*)> func)
|
||||
|
@ -12,7 +12,6 @@ namespace a8
|
||||
|
||||
class Room;
|
||||
class Human;
|
||||
class TeamAgent;
|
||||
class Team
|
||||
{
|
||||
public:
|
||||
@ -60,7 +59,6 @@ class Team
|
||||
void IncKillCount();
|
||||
int GetKillCount();
|
||||
long long GetLastKillFrameNo() { return last_kill_frameno_; }
|
||||
TeamAgent* GetTeamAgent() { return team_agent_; }
|
||||
|
||||
private:
|
||||
int team_id_ = 0;
|
||||
@ -72,5 +70,4 @@ class Team
|
||||
bool auto_fill_ = false;
|
||||
int kill_count_ = 0;
|
||||
long long last_kill_frameno_ = 0;
|
||||
TeamAgent* team_agent_ = nullptr;
|
||||
};
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "team_agent.h"
|
||||
|
||||
#include "team.h"
|
||||
#include "creature.h"
|
||||
|
||||
TeamAgent::TeamAgent():BaseAgent()
|
||||
{
|
||||
@ -15,25 +16,25 @@ TeamAgent::~TeamAgent()
|
||||
|
||||
int TeamAgent::GetMemberNum()
|
||||
{
|
||||
return team_->GetMemberNum();
|
||||
return owner_->GetTeam()->GetMemberNum();
|
||||
}
|
||||
|
||||
int TeamAgent::GetPlayerNum()
|
||||
{
|
||||
return team_->GetPlayerNum();
|
||||
return owner_->GetTeam()->GetPlayerNum();
|
||||
}
|
||||
|
||||
int TeamAgent::GetAlivePlayerNum()
|
||||
{
|
||||
return team_->GetAlivePlayerNum();
|
||||
return owner_->GetTeam()->GetAlivePlayerNum();
|
||||
}
|
||||
|
||||
void TeamAgent::SetTeam(Team* team)
|
||||
void TeamAgent::SetOwner(Creature* owner)
|
||||
{
|
||||
team_ = team;
|
||||
owner_ = owner;
|
||||
}
|
||||
|
||||
Room* TeamAgent::GetRoom()
|
||||
{
|
||||
return team_->room;
|
||||
return owner_->GetTeam()->room;
|
||||
}
|
||||
|
@ -17,9 +17,9 @@ public:
|
||||
int GetPlayerNum();
|
||||
int GetAlivePlayerNum();
|
||||
|
||||
void SetTeam(Team* team);
|
||||
void SetOwner(Creature* owner);
|
||||
Room* GetRoom();
|
||||
|
||||
private:
|
||||
Team* team_ = nullptr;
|
||||
Creature* owner_ = nullptr;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user