1
This commit is contained in:
parent
8a3593701e
commit
00ffaf6641
@ -393,13 +393,18 @@ int Incubator::GetPveLeftTime()
|
||||
void Incubator::NextWave()
|
||||
{
|
||||
if (room->pve_data.GetWave() < wave_timers_.size()) {
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("NextWave \n", {});
|
||||
#endif
|
||||
int acc_time = 0;
|
||||
{
|
||||
xtimer_list* timer = wave_timers_[room->pve_data.GetWave()];
|
||||
int remain_time = room->xtimer.GetRemainTime(timer);
|
||||
room->xtimer.ModifyTimer(timer, 0);
|
||||
room->xtimer.ModifyTimer
|
||||
(timer, room->pve_mode_meta->pb->wave_prepare_time() * SERVER_FRAME_RATE);
|
||||
acc_time = remain_time;
|
||||
}
|
||||
acc_time -= room->pve_mode_meta->pb->wave_prepare_time() * SERVER_FRAME_RATE;
|
||||
for (int i = room->pve_data.GetWave(); i < wave_timers_.size(); ++i) {
|
||||
xtimer_list* timer = wave_timers_[i];
|
||||
int remain_time = room->xtimer.GetRemainTime(timer);
|
||||
|
@ -127,18 +127,33 @@ void PveData::FlyDoor(Room* room, a8::Vec2& point, int radius)
|
||||
killed_num
|
||||
});
|
||||
#endif
|
||||
room->TraverseHumanList
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
a8::XParams(),
|
||||
[this, room, &point, radius] (Human* hum, a8::XParams& param)
|
||||
room->pve_mode_meta->pb->wave_prepare_time() * SERVER_FRAME_RATE,
|
||||
a8::XParams()
|
||||
.SetSender(room)
|
||||
.SetParam1(point.x)
|
||||
.SetParam2(point.y)
|
||||
.SetParam3(radius),
|
||||
[] (const a8::XParams& param)
|
||||
{
|
||||
a8::Vec2 dir = a8::Vec2::UP;
|
||||
dir.Rotate(a8::RandAngle());
|
||||
a8::Vec2 new_pos = point + dir * a8::RandEx(1, radius);
|
||||
hum->SetPos(new_pos);
|
||||
//hum->TryAddBuff(hum, 1025);
|
||||
room->grid_service->MoveCreature(hum);
|
||||
return true;
|
||||
});
|
||||
Room* room = (Room*)param.sender.GetUserData();
|
||||
a8::Vec2 point((float)param.param1.GetDouble(), (float)param.param2.GetDouble());
|
||||
float radius = param.param3.GetDouble();
|
||||
room->TraverseHumanList
|
||||
(
|
||||
a8::XParams(),
|
||||
[room, &point, radius] (Human* hum, a8::XParams& param)
|
||||
{
|
||||
a8::Vec2 dir = a8::Vec2::UP;
|
||||
dir.Rotate(a8::RandAngle());
|
||||
a8::Vec2 new_pos = point + dir * a8::RandEx(1, radius);
|
||||
hum->SetPos(new_pos);
|
||||
//hum->TryAddBuff(hum, 1025);
|
||||
room->grid_service->MoveCreature(hum);
|
||||
return true;
|
||||
});
|
||||
},
|
||||
&room->xtimer_attacher_.timer_list_);
|
||||
room->GetIncubator()->NextWave();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user