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),
0.0f,
hero_meta->radius() + 1 + radius + (50 * i));
GlmHelper::RotateY(born_offset, GlmHelper::CalcAngle(born_dir, GlmHelper::UP));
GlmHelper::RotateY(born_offset, (last_hero_idx + i) * 0.5);
glm::vec3 hero_pos = center + born_offset;
glm::vec3 dir = born_offset;
GlmHelper::Normalize(dir);
Position pos;
pos.SetX(hero_pos.x);
pos.SetY(hero_pos.y);
// 888
#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, hero_meta,
pos, pos,
dir, dir,
team_id); team_id);
if (!hero) { if (hero) {
A8_ABORT(); #ifdef DEBUG
} room_->BroadcastDebugMsg
last_hero_idx = i; (a8::Format("ShuaMon pos:%f,%f,%f hero_id:%d",
#ifdef DEBUG
BroadcastDebugMsg(a8::Format("ShuaMon pos:%d,%d hero_id:%d",
{ {
hero_pos.x, hero->GetPos().GetX(),
hero_pos.y, hero->GetPos().GetY(),
hero->meta->id() hero->GetPos().GetZ(),
hero_meta->id()
})); }));
#endif #endif
break; }
}
} }
#endif
}//end for i
}//end if
}//end for hero_id
} }