78 lines
1.5 KiB
C++
78 lines
1.5 KiB
C++
#include "precompile.h"
|
|
|
|
#include "android.h"
|
|
#include "metamgr.h"
|
|
#include "android.ai.h"
|
|
#include "zombie.ai.h"
|
|
#include "room.h"
|
|
#include "app.h"
|
|
|
|
Android::Android():Human()
|
|
{
|
|
ai = new ZombieAI;
|
|
ai->owner = this;
|
|
#if 0
|
|
++PerfMonitor::Instance()->entity_num[ET_Android];
|
|
#endif
|
|
}
|
|
|
|
Android::~Android()
|
|
{
|
|
delete ai;
|
|
ai = nullptr;
|
|
#if 0
|
|
--PerfMonitor::Instance()->entity_num[ET_Android];
|
|
#endif
|
|
}
|
|
|
|
void Android::Initialize()
|
|
{
|
|
Human::Initialize();
|
|
RandSkin();
|
|
GiveEquip();
|
|
RecalcBaseAttr();
|
|
}
|
|
|
|
void Android::Update(int delta_time)
|
|
{
|
|
if (UpdatedTimes() <= 0) {
|
|
if (room->GetFrameNo() % 2 != 0) {
|
|
return;
|
|
}
|
|
}
|
|
InternalUpdate(delta_time);
|
|
++updated_times_;
|
|
}
|
|
|
|
void Android::InternalUpdate(int delta_time)
|
|
{
|
|
if (a8::HasBitFlag(status, HS_Disable)) {
|
|
return;
|
|
}
|
|
if (action_type != AT_None) {
|
|
UpdateAction();
|
|
}
|
|
ai->Update(delta_time);
|
|
}
|
|
|
|
void Android::GiveEquip()
|
|
{
|
|
MetaData::Equip* weapon_meta = MetaMgr::Instance()->GetEquip(robot_meta->i->weapon_id());
|
|
if (weapon_meta) {
|
|
weapons[GUN_SLOT1].weapon_idx = GUN_SLOT1;
|
|
weapons[GUN_SLOT1].weapon_id = weapon_meta->i->id();
|
|
weapons[GUN_SLOT1].weapon_lv = robot_meta->i->weapon_lv();
|
|
weapons[GUN_SLOT1].ammo = 0;
|
|
weapons[GUN_SLOT1].meta = weapon_meta;
|
|
weapons[GUN_SLOT1].Recalc();
|
|
curr_weapon = &weapons[GUN_SLOT1];
|
|
}
|
|
}
|
|
|
|
void Android::SetAiLevel(int ai_level)
|
|
{
|
|
if (ai) {
|
|
ai->SetAiLevel(ai_level);
|
|
}
|
|
}
|