aozhiwei 1656f6000c 1
2019-05-17 12:00:31 +08:00

49 lines
1.1 KiB
C++

#include "precompile.h"
#include "android.h"
#include "metamgr.h"
#include "android.ai.h"
#include "room.h"
Android::Android():Human()
{
entity_type = ET_Player;
entity_subtype = EST_Android;
ai = new AndroidAI;
ai->owner = this;
}
Android::~Android()
{
delete ai;
ai = nullptr;
}
void Android::Initialize()
{
health = meta->i->health();
skin = 14001;
RecalcSelfCollider();
MetaData::Equip* weapon_meta = MetaMgr::Instance()->GetEquip(a8::RandEx(12103, 12122));
if (weapon_meta) {
weapons[GUN_SLOT1].weapon_idx = GUN_SLOT1;
weapons[GUN_SLOT1].weapon_id = weapon_meta->i->id();
weapons[GUN_SLOT1].weapon_lv = 1;
weapons[GUN_SLOT1].ammo = 0;
weapons[GUN_SLOT1].meta = weapon_meta;
curr_weapon = &weapons[GUN_SLOT1];
}
}
void Android::Update(int delta_time)
{
if (a8::HasBitFlag(status, HS_Fly)) {
pos = room->plane.curr_pos;
room->grid_service.MoveHuman(this);
}
if (action_type != AT_None) {
UpdateAction();
}
ai->Update(delta_time);
}