1
This commit is contained in:
parent
12217fc81a
commit
a20e81bed1
@ -802,7 +802,6 @@ bool Bullet::IsFlyHook()
|
||||
|
||||
void Bullet::GetHitThings(BulletCheckResult& result)
|
||||
{
|
||||
#if 1
|
||||
room->TraverseEntityList
|
||||
(
|
||||
[this] (Entity* e)
|
||||
@ -834,59 +833,6 @@ void Bullet::GetHitThings(BulletCheckResult& result)
|
||||
}
|
||||
return true;
|
||||
});
|
||||
#else
|
||||
std::set<ColliderComponent*> colliders;
|
||||
room->map_service->GetColliders(room, GetPos().GetX(), GetPos().GetY(), colliders);
|
||||
for (ColliderComponent* collider : colliders) {
|
||||
if (collider->owner->IsEntityType(ET_Dummy)) {
|
||||
if (a8::HasBitFlag(collider->tag, kHalfWallTag)) {
|
||||
continue;
|
||||
}
|
||||
if (TestCollision(room, collider)) {
|
||||
++result.o_hit_num;
|
||||
result.objects.insert(collider->owner);
|
||||
}
|
||||
} else if (collider->owner->IsEntityType(ET_Obstacle)) {
|
||||
Obstacle* obstacle = (Obstacle*)collider->owner;
|
||||
if (gun_meta->is_penetrate_thing() &&
|
||||
hit_objects_.find(obstacle->GetUniId()) != hit_objects_.end()) {
|
||||
//穿物件
|
||||
continue;
|
||||
}
|
||||
if (!obstacle->CanThroughable(this)) {
|
||||
if (TestCollision(room, collider)) {
|
||||
result.objects.insert(collider->owner);
|
||||
if (gun_meta->is_penetrate_thing()) {
|
||||
++result.t_hit_num;
|
||||
++result.o_hit_num;
|
||||
hit_objects_.insert(collider->owner->GetUniId());
|
||||
}
|
||||
}
|
||||
} else if (obstacle->meta->thing_type() == kObstacleStrengthenWall) {
|
||||
if (!strengthened_ && sender.Get() &&
|
||||
sender.Get()->team_id == obstacle->GetTeamId(room)) {
|
||||
bool ret = Check2dRotationRectangle
|
||||
(GetPos().x,
|
||||
GetPos().z,
|
||||
gun_meta->bullet_rad(),
|
||||
obstacle->GetPos().x,
|
||||
obstacle->GetPos().z,
|
||||
obstacle->meta->width(),
|
||||
obstacle->meta->height(),
|
||||
obstacle->GetRotate() * 180.0f
|
||||
);
|
||||
if (ret) {
|
||||
strengthened_ = true;
|
||||
OnStrengthen(obstacle);
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("命中能量墙\n", {});
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Bullet::GetHitCreatures(BulletCheckResult& result)
|
||||
|
Loading…
x
Reference in New Issue
Block a user