This commit is contained in:
aozhiwei 2019-05-17 13:33:42 +08:00
parent b2f0e4f111
commit 57df957162
2 changed files with 7 additions and 2 deletions

View File

@ -38,7 +38,7 @@ void Bullet::Update(int delta_time)
for (auto& grid : grid_list) {
for (Human* hum: grid->human_list) {
#if 1
if (hum != player) {
if (hum != player && !hum->dead) {
#else
if (hum != player &&
(hum->team_id == 0 || player->team_id != hum->team_id)) {

View File

@ -229,9 +229,14 @@ Human* Room::FindEnemy(Human* hum)
{
std::vector<Human*> enemys;
enemys.reserve(50);
EntitySubType_e sub_type = EST_Player;
if ((rand() % 10) < 2) {
sub_type = EST_Android;
}
for (auto& cell : hum->grid_list) {
for (Human* target : cell->human_list) {
if (target->entity_subtype == EST_Player) {
if (target->entity_subtype == sub_type &&
!target->dead) {
if (hum->pos.Distance(target->pos) < 300.0f) {
if (target->team_id == 0 ||
target->team_id != hum->team_id