This commit is contained in:
aozhiwei 2023-04-01 14:57:52 +08:00
parent ea53d6bd8a
commit 195e8fb999

View File

@ -5,6 +5,7 @@
#include "airdrop.h" #include "airdrop.h"
#include "room.h" #include "room.h"
#include "roomobstacle.h" #include "roomobstacle.h"
#include "hero.h"
#include "mt/AirDrop.h" #include "mt/AirDrop.h"
#include "mt/MapThing.h" #include "mt/MapThing.h"
@ -88,61 +89,29 @@ void AirDrop::Exec(int appear_time, int box_id, int airdrop_id)
void AirDrop::ShuaMon(const glm::vec3& center, const std::vector<int>& airdrop_mon_list, float radius) void AirDrop::ShuaMon(const glm::vec3& center, const std::vector<int>& airdrop_mon_list, float radius)
{ {
int last_hero_idx = 0;
for (int hero_id : airdrop_mon_list) { for (int hero_id : airdrop_mon_list) {
const mt::Hero* hero_meta = mt::Hero::GetById(hero_id); const mt::Hero* hero_meta = mt::Hero::GetById(hero_id);
if (hero_meta) { if (hero_meta) {
int team_id = 666; int team_id = 666;
Creature* master = nullptr; glm::vec3 pos;
for (int i = 0; i < 10; ++i) { glm::vec3 dir;
glm::vec3 born_dir = center; Hero* hero = room_->CreateHero(nullptr,
glm::vec3 born_offset(hero_meta->radius() + 1 + radius + (50 * i), hero_meta,
0.0f, pos,
hero_meta->radius() + 1 + radius + (50 * i)); dir,
GlmHelper::RotateY(born_offset, GlmHelper::CalcAngle(born_dir, GlmHelper::UP)); team_id);
GlmHelper::RotateY(born_offset, (last_hero_idx + i) * 0.5); if (hero) {
#ifdef DEBUG
glm::vec3 hero_pos = center + born_offset; room_->BroadcastDebugMsg
glm::vec3 dir = born_offset; (a8::Format("ShuaMon pos:%f,%f,%f hero_id:%d",
GlmHelper::Normalize(dir); {
hero->GetPos().GetX(),
Position pos; hero->GetPos().GetY(),
pos.SetX(hero_pos.x); hero->GetPos().GetZ(),
pos.SetY(hero_pos.y); hero_meta->id()
}));
// 888 #endif
#if 0 }
CircleCollider collider; }
collider.pos = hero_pos; }
collider.rad = hero_meta->radius();
if (!map_service->CollisionDetection
(
this,
false,
pos,
&collider
)) {
Hero* hero = CreateHero(master,
hero_meta,
pos,
dir,
team_id);
if (!hero) {
A8_ABORT();
}
last_hero_idx = i;
#ifdef DEBUG
BroadcastDebugMsg(a8::Format("ShuaMon pos:%d,%d hero_id:%d",
{
hero_pos.x,
hero_pos.y,
hero->meta->id()
}));
#endif
break;
}
#endif
}//end for i
}//end if
}//end for hero_id
} }