1
This commit is contained in:
parent
de38d43230
commit
8de1da34f2
@ -7,8 +7,10 @@
|
||||
#include "player.h"
|
||||
#include "pbutils.h"
|
||||
#include "glmhelper.h"
|
||||
#include "mapinstance.h"
|
||||
|
||||
#include "mt/Param.h"
|
||||
#include "mt/Map.h"
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/PveGemini.h"
|
||||
#include "mt/PveGeminiMode.h"
|
||||
@ -69,23 +71,21 @@ void Incubator::AllocAndroid(Human* target, int num)
|
||||
}
|
||||
int try_count = 0;
|
||||
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());
|
||||
int rand_len = rand() % mt::Param::s().incubator_rand_length;
|
||||
Human* hum = hold_humans_[0];
|
||||
Position old_pos = hum->GetPos();
|
||||
// 999
|
||||
#if 1
|
||||
#else
|
||||
hum->SetPos(target->GetPos() + dir * (MetaMgr::Instance()->incubator_base_length + rand_len));
|
||||
#endif
|
||||
#if 1
|
||||
if (true) {
|
||||
#else
|
||||
if (hum->CollisonDetection() || !CanSee(hum, target)) {
|
||||
hum->SetPos(old_pos);
|
||||
#endif
|
||||
} else {
|
||||
Human* hum = hold_humans_.at(0);
|
||||
glm::vec3 center = target->GetPos().ToGlmVec3() + dir * (float)(mt::Param::s().incubator_base_length + rand_len);
|
||||
glm::vec3 point;
|
||||
if (room->map_instance->FindRandomPointAroundCircle
|
||||
(
|
||||
center,
|
||||
10 * room->GetMapMeta()->scale(),
|
||||
point
|
||||
)) {
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
hum->GetMutablePos().FromGlmVec3(point);
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
room->EnableHuman(hum);
|
||||
#ifdef DEBUG
|
||||
#if 0
|
||||
@ -103,7 +103,7 @@ void Incubator::AllocAndroid(Human* target, int num)
|
||||
#ifdef DEBUG
|
||||
room->BroadcastDebugMsg(a8::Format("投放机器人 %d:%s pos:%d,%d pos1:%d,%d %d num:%d",
|
||||
{hum->GetUniId(),
|
||||
hum->name,
|
||||
hum->name,
|
||||
hum->GetPos().GetX(),
|
||||
hum->GetPos().GetY(),
|
||||
target->GetPos().GetX(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user