From bbd187541c00eac8daa6ee403d169a67ba597ea5 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 28 Dec 2022 19:19:43 +0800 Subject: [PATCH] 1 --- server/gameserver/incubator.cc | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/server/gameserver/incubator.cc b/server/gameserver/incubator.cc index 11fc4768..24c6c4ff 100644 --- a/server/gameserver/incubator.cc +++ b/server/gameserver/incubator.cc @@ -6,6 +6,8 @@ #include "hero.h" #include "player.h" #include "pbutils.h" +#include "glmhelper.h" + #include "mt/Param.h" #include "mt/Hero.h" #include "mt/PveGemini.h" @@ -64,9 +66,9 @@ void Incubator::AllocAndroid(Human* target, int num) A8_ABORT(); } int try_count = 0; - a8::Vec2 dir = a8::Vec2::UP; + glm::vec3 dir = GlmHelper::UP; while (num > 0 && try_count < 20 && !hold_humans_.empty()) { - dir.Rotate(a8::RandAngle()); + 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(); @@ -227,10 +229,12 @@ void Incubator::AutoAllocAndroid() void Incubator::ActiveAndroid(Human* hum, Human* android) { - a8::Vec2 center = room->GetGasData().pos_new; + glm::vec3 center = glm::vec3(room->GetGasData().pos_new.x, + 0.0f, + room->GetGasData().pos_new.y); float start_distance = a8::RandEx(200, 600); - a8::Vec2 start_dir = a8::Vec2::UP; - start_dir.Rotate(a8::RandAngle()); + glm::vec3 start_dir = GlmHelper::UP; + GlmHelper::RotateY(start_dir, a8::RandAngle()); android->SetPos(hum->GetPos()); int try_count = 0; @@ -326,13 +330,7 @@ void Incubator::SpawnWaveMon(int wave) int team_id = 666; Creature* master = nullptr; - // 999 -#if 1 glm::vec3 dir = GlmHelper::UP; -#else - a8::Vec2 dir = hero_pos; - dir.Normalize(); -#endif Hero* hero = room->CreateHero(master, hero_meta,