优化机器人死亡逻辑
This commit is contained in:
parent
45f95035e5
commit
15dc16633f
@ -2128,17 +2128,20 @@ void Room::ProcDieAndroid(int die_time, int die_num)
|
|||||||
#endif
|
#endif
|
||||||
std::vector<Android*> alive_humans;
|
std::vector<Android*> alive_humans;
|
||||||
alive_humans.reserve(human_hash_.size());
|
alive_humans.reserve(human_hash_.size());
|
||||||
for (auto& pair : human_hash_) {
|
{
|
||||||
if (pair.second->IsAndroid() &&
|
if (frame_no % 8 < 5) {
|
||||||
!pair.second->real_dead &&
|
for (auto itr = human_hash_.begin(); itr != human_hash_.end(); ++itr) {
|
||||||
pair.second->team_uuid.empty() &&
|
CheckAliveHuman(itr->second, alive_humans);
|
||||||
a8::HasBitFlag(pair.second->status, HS_Disable) &&
|
if (alive_humans.size() > 16) {
|
||||||
!HasPlayerInRound(pair.second->GetPos(), VIEW_RANGE))
|
break;
|
||||||
{
|
}
|
||||||
Android* hum = (Android*)pair.second;
|
}
|
||||||
alive_humans.push_back(hum);
|
} else {
|
||||||
if (alive_humans.size() > 20) {
|
for (auto itr = human_hash_.rbegin(); itr != human_hash_.rend(); ++itr) {
|
||||||
break;
|
CheckAliveHuman(itr->second, alive_humans);
|
||||||
|
if (alive_humans.size() > 16) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2398,3 +2401,15 @@ void Room::CheckPartObjects(Human* testa, Human* testb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Room::CheckAliveHuman(Human* hum, std::vector<Android*>& alive_humans)
|
||||||
|
{
|
||||||
|
if (hum->IsAndroid() &&
|
||||||
|
!hum->real_dead &&
|
||||||
|
hum->team_uuid.empty() &&
|
||||||
|
a8::HasBitFlag(hum->status, HS_Disable) &&
|
||||||
|
!HasPlayerInRound(hum->GetPos(), VIEW_RANGE)) {
|
||||||
|
Android* hum = (Android*)hum;
|
||||||
|
alive_humans.push_back(hum);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -36,6 +36,7 @@ class Player;
|
|||||||
class Building;
|
class Building;
|
||||||
class Hero;
|
class Hero;
|
||||||
class AabbCollider;
|
class AabbCollider;
|
||||||
|
class Android;
|
||||||
class Room
|
class Room
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -169,6 +170,7 @@ private:
|
|||||||
void ProcDisableHuman();
|
void ProcDisableHuman();
|
||||||
void OnHumanGridChg(Human* target);
|
void OnHumanGridChg(Human* target);
|
||||||
void ShuaGridRound(Human* target);
|
void ShuaGridRound(Human* target);
|
||||||
|
void CheckAliveHuman(Human* hum, std::vector<Android*>& alive_humans);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int elapsed_time_ = 0;
|
int elapsed_time_ = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user