This commit is contained in:
aozhiwei 2020-07-23 17:52:37 +08:00
parent ee1a5a0417
commit 6acf3a2fb5
4 changed files with 16 additions and 3 deletions

View File

@ -3,12 +3,13 @@
#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 AndroidNewAI;
ai = new ZombieAI;
ai->owner = this;
#if 0
++PerfMonitor::Instance()->entity_num[ET_Android];

View File

@ -1861,8 +1861,6 @@ void Human::ChangeToRace(RaceType_e race, int level)
}
race_ = race;
level_ = level;
room->frame_event.AddRaceChg(this);
room->frame_event.AddLevelChg(this);
if (race_ == kHumanRace) {
meta = MetaMgr::Instance()->GetPlayer(HUMAN_RACE_META_START_ID + level_ - 1);
if (!meta) {
@ -1880,6 +1878,13 @@ void Human::ChangeToRace(RaceType_e race, int level)
}
}
void Human::ChangeToRaceAndNotify(RaceType_e race, int level)
{
ChangeToRace(race, level);
room->frame_event.AddRaceChg(this);
room->frame_event.AddLevelChg(this);
}
void Human::_InternalUpdateMove(float speed)
{
float nx = move_dir.x * speed;

View File

@ -281,6 +281,7 @@ class Human : public MoveableEntity
void _UpdateMove(int speed);
RaceType_e GetRace() { return race_; }
void ChangeToRace(RaceType_e race, int level);
void ChangeToRaceAndNotify(RaceType_e race, int level);
protected:
void _InternalUpdateMove(float speed);

View File

@ -306,6 +306,9 @@ void Room::CreateAndroid(int robot_num)
alive_count_chged_frameno_ = GetFrameNo();
++PerfMonitor::Instance()->alive_count;
refreshed_robot_set_.insert(robot_meta->i->id());
if (GetRoomMode() == kZombieMode) {
hum->ChangeToRace(kHumanRace, 1);
}
if (!CanAddToScene(hum)) {
a8::SetBitFlag(hum->status, HS_Disable);
@ -2494,6 +2497,9 @@ void Room::AddPlayerPostProc(Player* hum)
while (human_hash_.size() > GetRoomMaxPlayerNum()) {
RandRemoveAndroid();
}
if (GetRoomMode() == kZombieMode) {
hum->ChangeToRace(kHumanRace, 1);
}
#ifdef DEBUG
xtimer.AddRepeatTimerAndAttach
(SERVER_FRAME_RATE * 5,