This commit is contained in:
aozhiwei 2023-04-20 14:19:30 +08:00
parent 7d8c641236
commit 8b19c8d637

View File

@ -6,6 +6,7 @@
#include "glmhelper.h"
#include "mt/GuideStep.h"
#include "mt/Hero.h"
void Guide::Init(Human* owner)
{
@ -103,6 +104,7 @@ void Guide::ProcMoveTargetAndPickup()
int time = std::get<0>(tuple);
glm::vec3 pos = std::get<1>(tuple);
int equip_id = std::get<2>(tuple);
++i;
context->loots.push_back(-1);
owner_->room->xtimer.SetTimeoutEx
(
@ -155,6 +157,60 @@ void Guide::ProcKillEnemy()
return;
}
auto context = A8_MAKE_ANON_STRUCT_SHARED
(
std::vector<Hero*> heros;
);
{
int i = 0;
for (auto& tuple : curr_step_meta_->_params) {
int time = std::get<0>(tuple);
glm::vec3 pos = std::get<1>(tuple);
int hero_id = std::get<2>(tuple);
const mt::Hero* hero_meta = mt::Hero::GetById(hero_id);
if (!hero_meta){
continue;
}
++i;
context->heros.push_back(nullptr);
owner_->room->xtimer.SetTimeoutEx
(
time / FRAME_RATE_MS,
[this, hero_id, hero_meta, pos, context, i ] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
context->heros[i] =
owner_->room->CreateHero
(
nullptr,
hero_meta,
pos,
pos,
666
)
;
}
},
&owner_->xtimer_attacher);
}
}
owner_->room->xtimer.SetTimeoutEx
(1,
[this, context] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
bool done = true;
for (Hero* hero : context->heros) {
}
if (done) {
NextStep();
}
}
},
&owner_->xtimer_attacher);
}
void Guide::ProcUseSkillAndKillEnemy()