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