修改gameover问题
This commit is contained in:
parent
537a7cab4e
commit
baedbcfc51
@ -525,7 +525,13 @@ void Human::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!HasLiveTeammate()) {
|
if (!HasLiveTeammate()) {
|
||||||
SendGameOver();
|
if (team_members) {
|
||||||
|
for (auto& member : *team_members) {
|
||||||
|
member->SendGameOver();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
SendGameOver();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -820,14 +820,12 @@ void Room::UpdateGas()
|
|||||||
if (!game_over && alive_count_ <= 1) {
|
if (!game_over && alive_count_ <= 1) {
|
||||||
game_over = true;
|
game_over = true;
|
||||||
game_over_frameno = frame_no;
|
game_over_frameno = frame_no;
|
||||||
|
OnGameOver();
|
||||||
}
|
}
|
||||||
for (auto& pair : human_hash_) {
|
for (auto& pair : human_hash_) {
|
||||||
if (pair.second->dead) {
|
if (pair.second->dead) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (game_over && game_over_frameno == frame_no) {
|
|
||||||
pair.second->SendGameOver();
|
|
||||||
}
|
|
||||||
bool b1 = CircleContainCircle(gas_data.pos_old,
|
bool b1 = CircleContainCircle(gas_data.pos_old,
|
||||||
gas_data.gas_progress,
|
gas_data.gas_progress,
|
||||||
pair.second->pos,
|
pair.second->pos,
|
||||||
@ -1055,3 +1053,12 @@ void Room::AddObjectLater(Entity* entity)
|
|||||||
add_func,
|
add_func,
|
||||||
&entity->xtimer_attacher.timer_list_);
|
&entity->xtimer_attacher.timer_list_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Room::OnGameOver()
|
||||||
|
{
|
||||||
|
for (auto& pair : human_hash_) {
|
||||||
|
if (game_over && game_over_frameno == frame_no) {
|
||||||
|
pair.second->SendGameOver();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -103,6 +103,7 @@ private:
|
|||||||
Obstacle* InternalCreateObstacle(int id, float x, float y,
|
Obstacle* InternalCreateObstacle(int id, float x, float y,
|
||||||
std::function<void (Obstacle*)> on_precreate);
|
std::function<void (Obstacle*)> on_precreate);
|
||||||
void AddObjectLater(Entity* entity);
|
void AddObjectLater(Entity* entity);
|
||||||
|
void OnGameOver();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
timer_list* stats_timer_ = nullptr;
|
timer_list* stats_timer_ = nullptr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user