1
This commit is contained in:
parent
80375b14e5
commit
06a3493db2
@ -2,6 +2,7 @@
|
||||
|
||||
#include "new_hero_agent.h"
|
||||
#include "hero.h"
|
||||
#include "room.h"
|
||||
|
||||
HeroAgent::HeroAgent():BaseAgent()
|
||||
{
|
||||
@ -19,7 +20,7 @@ void HeroAgent::Exec()
|
||||
|
||||
void HeroAgent::SetOwner(Creature* owner)
|
||||
{
|
||||
//room = owner->room;
|
||||
room_agent = owner->room->GetRoomAgent();
|
||||
owner_ = owner;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "target_agent.h"
|
||||
|
||||
#include "mt/Hero.h"
|
||||
|
||||
TargetAgent::TargetAgent():BaseAgent()
|
||||
{
|
||||
|
||||
@ -13,45 +15,63 @@ TargetAgent::~TargetAgent()
|
||||
|
||||
int TargetAgent::GetUniId()
|
||||
{
|
||||
|
||||
if (target_.Get()) {
|
||||
return target_.Get()->GetUniId();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool TargetAgent::IsValid()
|
||||
{
|
||||
|
||||
return target_.Get() && !target_.Get()->dead;
|
||||
}
|
||||
|
||||
bool TargetAgent::IsDead()
|
||||
{
|
||||
|
||||
if (target_.Get()) {
|
||||
return target_.Get()->dead;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const glm::vec3 TargetAgent::GetPos()
|
||||
{
|
||||
|
||||
return target_.Get()->GetPos().ToGlmVec3();
|
||||
}
|
||||
|
||||
float TargetAgent::GetHp()
|
||||
{
|
||||
|
||||
if (!target_.Get()) {
|
||||
abort();
|
||||
}
|
||||
return target_.Get()->GetHP();
|
||||
}
|
||||
|
||||
float TargetAgent::GetMaxHp()
|
||||
{
|
||||
|
||||
if (!target_.Get()) {
|
||||
abort();
|
||||
}
|
||||
return target_.Get()->GetMaxHP();
|
||||
}
|
||||
|
||||
int TargetAgent::GetHeroId()
|
||||
{
|
||||
|
||||
if (!target_.Get()) {
|
||||
abort();
|
||||
}
|
||||
return target_.Get()->GetHeroMeta()->id();
|
||||
}
|
||||
|
||||
int TargetAgent::GetLevel()
|
||||
{
|
||||
|
||||
if (!target_.Get()) {
|
||||
abort();
|
||||
}
|
||||
return target_.Get()->level;
|
||||
}
|
||||
|
||||
void TargetAgent::Abandon()
|
||||
{
|
||||
|
||||
target_.Reset();
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "new_base_agent.h"
|
||||
|
||||
#include "creature.h"
|
||||
|
||||
class TargetAgent : public BaseAgent
|
||||
{
|
||||
public:
|
||||
@ -21,4 +23,6 @@ public:
|
||||
int GetLevel();
|
||||
void Abandon();
|
||||
|
||||
private:
|
||||
CreatureWeakPtr target_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user