This commit is contained in:
aozhiwei 2023-04-02 16:27:59 +08:00
parent d145ffaa65
commit 6fa87b3c70

View File

@ -802,36 +802,36 @@ bool Bullet::IsFlyHook()
void Bullet::GetHitThings(BulletCheckResult& result)
{
room->TraverseEntityList
(
[this] (Entity* e)
room->grid_service->TraverseObstacles
(room->GetRoomIdx(),
GetGridList(),
[this] (Obstacle* ob, bool& stop)
{
if (e->IsEntityType(ET_Obstacle)) {
Obstacle* ob = (Obstacle*)e;
if (ob->meta->thing_type() == kObstacleStrengthenWall) {
if (!strengthened_ && sender.Get() &&
sender.Get()->team_id == ob->GetTeamId(room)) {
bool ret = Collision::Check2dRotationRectangle
(GetPos().GetX(),
GetPos().GetZ(),
gun_meta->bullet_rad(),
ob->GetPos().GetX(),
ob->GetPos().GetZ(),
ob->meta->width(),
ob->meta->height(),
ob->GetRotate() * 180.0f
);
if (ret) {
strengthened_ = true;
OnStrengthen(ob);
#if 1
#else
if (ob->meta->thing_type() == kObstacleStrengthenWall) {
if (!strengthened_ && sender.Get() &&
sender.Get()->team_id == ob->GetTeamId(room)) {
bool ret = Collision::Check2dRotationRectangle
(GetPos().GetX(),
GetPos().GetZ(),
gun_meta->bullet_rad(),
ob->GetPos().GetX(),
ob->GetPos().GetZ(),
ob->meta->width(),
ob->meta->height(),
ob->GetRotate() * 180.0f
);
if (ret) {
strengthened_ = true;
OnStrengthen(ob);
#ifdef DEBUG
a8::XPrintf("命中能量墙\n", {});
a8::XPrintf("命中能量墙\n", {});
#endif
}
}
}
}
return true;
#endif
});
}