This commit is contained in:
aozhiwei 2023-04-01 19:30:15 +08:00
parent 0f19b56010
commit 42803ff9b9

View File

@ -101,6 +101,9 @@ void Incubator::AllocAndroid(Human* target, int num, std::vector<Human*>* androi
#endif
hum->MustBeAddBuff(hum, kTraceBuffId);
hold_humans_.erase(hold_humans_.begin());
if (androids) {
androids->push_back(hum);
}
--num;
#ifdef DEBUG
room->BroadcastDebugMsg(a8::Format("投放机器人 %d:%s pos:%d,%d pos1:%d,%d %d num:%d",
@ -238,42 +241,23 @@ void Incubator::AutoAllocAndroid()
Human* Incubator::ActiveAndroid(Human* hum)
{
#if 0
glm::vec3 center = glm::vec3(room->GetGasData().pos_new.x,
0.0f,
room->GetGasData().pos_new.y);
float start_distance = a8::RandEx(200, 600);
glm::vec3 start_dir = GlmHelper::UP;
GlmHelper::RotateY(start_dir, a8::RandAngle());
Human* target = nullptr;
android->SetPos(hum->GetPos());
int try_count = 0;
// 999
#if 1
#else
while (++try_count < 100) {
android->SetPos(center + start_dir * start_distance);
if (android->CollisonDetection() && !CanSee(android, hum)) {
break;
}
}
#endif
room->EnableHuman(android);
for (auto itr = hold_humans_.begin(); itr != hold_humans_.end(); ++itr) {
if (*itr == android) {
hold_humans_.erase(itr);
break;
}
std::vector<Human*> androids;
AllocAndroid(hum, 1, &androids);
if (!androids.empty()) {
target = androids[0];
}
#ifdef DEBUG
room->BroadcastDebugMsg(a8::Format("active android id:%d pos:%d,%d",
room->BroadcastDebugMsg(a8::Format("active android id:%d pos:%f,%f,%f",
{
android->GetUniId(),
android->GetPos().GetX(),
android->GetPos().GetY()
target->GetUniId(),
target->GetPos().GetX(),
target->GetPos().GetY(),
target->GetPos().GetZ(),
}));
#endif
#endif
return target;
}
void Incubator::OnEnterNewWave(int wave)