This commit is contained in:
aozhiwei 2023-04-01 18:29:04 +08:00
parent de38d43230
commit 8de1da34f2

View File

@ -7,8 +7,10 @@
#include "player.h" #include "player.h"
#include "pbutils.h" #include "pbutils.h"
#include "glmhelper.h" #include "glmhelper.h"
#include "mapinstance.h"
#include "mt/Param.h" #include "mt/Param.h"
#include "mt/Map.h"
#include "mt/Hero.h" #include "mt/Hero.h"
#include "mt/PveGemini.h" #include "mt/PveGemini.h"
#include "mt/PveGeminiMode.h" #include "mt/PveGeminiMode.h"
@ -69,23 +71,21 @@ void Incubator::AllocAndroid(Human* target, int num)
} }
int try_count = 0; int try_count = 0;
glm::vec3 dir = GlmHelper::UP; glm::vec3 dir = GlmHelper::UP;
while (num > 0 && try_count < 20 && !hold_humans_.empty()) { while (num > 0 && try_count < 8 && !hold_humans_.empty()) {
GlmHelper::RotateY(dir, a8::RandAngle()); GlmHelper::RotateY(dir, a8::RandAngle());
int rand_len = rand() % mt::Param::s().incubator_rand_length; int rand_len = rand() % mt::Param::s().incubator_rand_length;
Human* hum = hold_humans_[0]; Human* hum = hold_humans_.at(0);
Position old_pos = hum->GetPos(); glm::vec3 center = target->GetPos().ToGlmVec3() + dir * (float)(mt::Param::s().incubator_base_length + rand_len);
// 999 glm::vec3 point;
#if 1 if (room->map_instance->FindRandomPointAroundCircle
#else (
hum->SetPos(target->GetPos() + dir * (MetaMgr::Instance()->incubator_base_length + rand_len)); center,
#endif 10 * room->GetMapMeta()->scale(),
#if 1 point
if (true) { )) {
#else Global::Instance()->verify_set_pos = 1;
if (hum->CollisonDetection() || !CanSee(hum, target)) { hum->GetMutablePos().FromGlmVec3(point);
hum->SetPos(old_pos); Global::Instance()->verify_set_pos = 0;
#endif
} else {
room->EnableHuman(hum); room->EnableHuman(hum);
#ifdef DEBUG #ifdef DEBUG
#if 0 #if 0
@ -103,7 +103,7 @@ void Incubator::AllocAndroid(Human* target, int 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",
{hum->GetUniId(), {hum->GetUniId(),
hum->name, hum->name,
hum->GetPos().GetX(), hum->GetPos().GetX(),
hum->GetPos().GetY(), hum->GetPos().GetY(),
target->GetPos().GetX(), target->GetPos().GetX(),