1
This commit is contained in:
parent
4ec90b2ed7
commit
45139ee491
@ -10,6 +10,7 @@
|
||||
#include "car.h"
|
||||
#include "app.h"
|
||||
#include "perfmonitor.h"
|
||||
#include "incubator.h"
|
||||
|
||||
void FrameMaker::Debug_FullObject(Human* hum)
|
||||
{
|
||||
@ -164,6 +165,10 @@ void FrameMaker::PostProcess(cs::SMUpdate* msg, Room* room, Human* hum, FrameDat
|
||||
room->GetFrameNo() - hum->join_frameno <= 2) {
|
||||
msg->set_alive_count(room->AliveCount());
|
||||
}
|
||||
if (room->IsPveRoom()) {
|
||||
int left_time = room->GetIncubator()->GetPveLeftTime();
|
||||
msg->set_game_left_time(left_time);
|
||||
}
|
||||
}
|
||||
|
||||
void FrameMaker::SerializeLootObjects(cs::SMUpdate* msg, Room* room, Human* hum, FrameData* framedata)
|
||||
|
@ -20,15 +20,12 @@ void Incubator::Init()
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
if (room->IsPveRoom()) {
|
||||
#if 0
|
||||
room->pve_data.wave = 1;
|
||||
#endif
|
||||
room->pve_data.max_wave = room->pve_mode_meta->mode_time.size();
|
||||
int wave = 0;
|
||||
int total_time = 0;
|
||||
for (int time : room->pve_mode_meta->mode_time) {
|
||||
total_time += time;
|
||||
room->xtimer.AddDeadLineTimerAndAttach
|
||||
xtimer_list* timer = room->xtimer.AddDeadLineTimerAndAttach
|
||||
(
|
||||
total_time * SERVER_FRAME_RATE / 2,
|
||||
a8::XParams()
|
||||
@ -40,6 +37,7 @@ void Incubator::Init()
|
||||
incubator->SpawnWaveMon(param.param1.GetInt());
|
||||
},
|
||||
&xtimer_attacher_.timer_list_);
|
||||
wave_timers_.push_back(timer);
|
||||
++wave;
|
||||
}
|
||||
}
|
||||
@ -248,6 +246,7 @@ void Incubator::SpawnWaveMon(int wave)
|
||||
if (room->IsGameOver()) {
|
||||
return;
|
||||
}
|
||||
curr_wave_ = wave;
|
||||
room->OnEnterNewWave(wave);
|
||||
if (wave < 0) {
|
||||
abort();
|
||||
@ -308,3 +307,14 @@ void Incubator::SpawnWaveMon(int wave)
|
||||
}
|
||||
++room->pve_data.wave;
|
||||
}
|
||||
|
||||
int Incubator::GetPveLeftTime()
|
||||
{
|
||||
if (curr_wave_ >= wave_timers_.size() ||
|
||||
curr_wave_ < 0) {
|
||||
abort();
|
||||
}
|
||||
xtimer_list* timer = wave_timers_[curr_wave_];
|
||||
int remain_time = room->xtimer.GetRemainTime(timer);
|
||||
return remain_time * FRAME_RATE_MS;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ class Incubator
|
||||
void RecycleAndroid(Human* hum);
|
||||
void ActiveAndroid(Human* hum, Human* android);
|
||||
bool IsTimeOut() { return timeout_; };
|
||||
int GetPveLeftTime();
|
||||
|
||||
private:
|
||||
bool CanSee(Human* hum, Human* exclude_hum);
|
||||
@ -22,7 +23,9 @@ private:
|
||||
void SpawnWaveMon(int wave);
|
||||
|
||||
private:
|
||||
int curr_wave_= 0;
|
||||
bool timeout_ = false;
|
||||
std::vector<Human*> hold_humans_;
|
||||
std::vector<xtimer_list*> wave_timers_;
|
||||
a8::XTimerAttacher xtimer_attacher_;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user