65 lines
1.4 KiB
C++
65 lines
1.4 KiB
C++
#include "precompile.h"
|
|
|
|
#include "hero.h"
|
|
#include "human.h"
|
|
#include "room.h"
|
|
#include "metamgr.h"
|
|
#include "loot.h"
|
|
#include "perfmonitor.h"
|
|
#include "typeconvert.h"
|
|
|
|
Hero::Hero():MoveableEntity()
|
|
{
|
|
++PerfMonitor::Instance()->entity_num[ET_Hero];
|
|
}
|
|
|
|
Hero::~Hero()
|
|
{
|
|
--PerfMonitor::Instance()->entity_num[ET_Hero];
|
|
}
|
|
|
|
void Hero::Initialize()
|
|
{
|
|
MoveableEntity::Initialize();
|
|
}
|
|
|
|
void Hero::FillMFObjectPart(Room* room, Human* hum, cs::MFObjectPart* part_data)
|
|
{
|
|
part_data->set_object_type(ET_Hero);
|
|
cs::MFHeroPart* p = part_data->mutable_union_obj_10();
|
|
p->set_obj_uniid(GetEntityUniId());
|
|
TypeConvert::ToPb(GetPos(), p->mutable_pos());
|
|
TypeConvert::ToPb(move_dir, p->mutable_dir());
|
|
}
|
|
|
|
void Hero::FillMFObjectFull(Room* room, Human* hum, cs::MFObjectFull* full_data)
|
|
{
|
|
full_data->set_object_type(ET_Hero);
|
|
cs::MFHeroFull* p = full_data->mutable_union_obj_10();
|
|
p->set_obj_uniid(GetEntityUniId());
|
|
TypeConvert::ToPb(GetPos(), p->mutable_pos());
|
|
TypeConvert::ToPb(move_dir, p->mutable_dir());
|
|
p->set_heroid(meta->i->id());
|
|
p->set_master_uniid(master ? master->GetEntityUniId() : 0);
|
|
}
|
|
|
|
void Hero::Update(int delta_time)
|
|
{
|
|
++updated_times_;
|
|
}
|
|
|
|
bool Hero::HasBuffEffect(int buff_effect_id)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
Buff* Hero::GetBuffByEffectId(int effect_id)
|
|
{
|
|
return nullptr;
|
|
}
|
|
|
|
float Hero::GetSpeed()
|
|
{
|
|
return 3;
|
|
}
|