1
This commit is contained in:
parent
0f19b56010
commit
42803ff9b9
@ -101,6 +101,9 @@ void Incubator::AllocAndroid(Human* target, int num, std::vector<Human*>* androi
|
|||||||
#endif
|
#endif
|
||||||
hum->MustBeAddBuff(hum, kTraceBuffId);
|
hum->MustBeAddBuff(hum, kTraceBuffId);
|
||||||
hold_humans_.erase(hold_humans_.begin());
|
hold_humans_.erase(hold_humans_.begin());
|
||||||
|
if (androids) {
|
||||||
|
androids->push_back(hum);
|
||||||
|
}
|
||||||
--num;
|
--num;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
room->BroadcastDebugMsg(a8::Format("投放机器人 %d:%s pos:%d,%d pos1:%d,%d %d num:%d",
|
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)
|
Human* Incubator::ActiveAndroid(Human* hum)
|
||||||
{
|
{
|
||||||
#if 0
|
Human* target = nullptr;
|
||||||
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());
|
|
||||||
|
|
||||||
android->SetPos(hum->GetPos());
|
std::vector<Human*> androids;
|
||||||
int try_count = 0;
|
AllocAndroid(hum, 1, &androids);
|
||||||
// 999
|
if (!androids.empty()) {
|
||||||
#if 1
|
target = androids[0];
|
||||||
#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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#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(),
|
target->GetUniId(),
|
||||||
android->GetPos().GetX(),
|
target->GetPos().GetX(),
|
||||||
android->GetPos().GetY()
|
target->GetPos().GetY(),
|
||||||
|
target->GetPos().GetZ(),
|
||||||
}));
|
}));
|
||||||
#endif
|
#endif
|
||||||
#endif
|
return target;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Incubator::OnEnterNewWave(int wave)
|
void Incubator::OnEnterNewWave(int wave)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user