This commit is contained in:
aozhiwei 2024-01-30 11:44:38 +08:00
parent 397ad07d32
commit 7c3102e52f

View File

@ -165,17 +165,35 @@ void Room::Init()
} }
}, },
&xtimer_attacher_); &xtimer_attacher_);
xtimer.SetIntervalWpEx if (mt::Param::s().moba_towers.size() != 2) {
(SERVER_FRAME_RATE * mt::Param::s().moba_tower_interval, xtimer.SetIntervalWpEx
[this] (int event, const a8::Args* args) (SERVER_FRAME_RATE * mt::Param::s().moba_tower_interval,
{ [this] (int event, const a8::Args* args)
if (a8::TIMER_EXEC_EVENT == event) { {
if (!IsGameOver() && !GetVictoryTeam()) { if (a8::TIMER_EXEC_EVENT == event) {
if (!IsGameOver() && !GetVictoryTeam()) {
for (size_t i = 0; i < 2; ++i) {
Team* team = GetMobaTeamA();
if (i == 1) {
team = GetMobaTeamB();
}
auto tuple = mt::Param::s().moba_towers.at(i);
team->TraverseMembers
(
[&tuple] (Human* hum) -> bool
{
float distance = hum->GetPos().Distance2D2(std::get<0>(tuple));
if (distance < std::get<1>(tuple)) {
}
return true;
});
}
}
} }
} },
}, &xtimer_attacher_);
&xtimer_attacher_); }
} }
ob_ = std::make_shared<RoomOb>(this); ob_ = std::make_shared<RoomOb>(this);
ob_->Init(); ob_->Init();