This commit is contained in:
aozhiwei 2021-07-30 03:57:54 +00:00
parent 6de0120c35
commit b819435e53
3 changed files with 18 additions and 1 deletions

View File

@ -395,7 +395,11 @@ void Bullet::Check(float distance)
std::set<ColliderComponent*> colliders;
room->map_service->GetColliders(room, GetX(), GetY(), colliders);
for (ColliderComponent* collider : colliders) {
if (collider->owner->IsEntityType(ET_Obstacle)) {
if (collider->owner->IsEntityType(ET_Dummy)) {
if (TestCollision(room, collider)) {
objects.insert(collider->owner);
}
} else if (collider->owner->IsEntityType(ET_Obstacle)) {
Obstacle* obstacle = (Obstacle*)collider->owner;
if (gun_meta->i->is_penetrate_thing() &&
hit_objects_.find(obstacle->GetUniId()) != hit_objects_.end()) {

View File

@ -50,3 +50,13 @@ void DummyEntity::Initialize()
}
}
}
void DummyEntity::OnBulletHit(Bullet* bullet)
{
}
void DummyEntity::OnExplosionHit(Explosion* explosion)
{
}

View File

@ -15,4 +15,7 @@ class DummyEntity : public Entity
std::list<metatable::MapBlockJson>* blocks = nullptr;
virtual void Initialize() override;
virtual void OnBulletHit(Bullet* bullet) override;
virtual void OnExplosionHit(Explosion* explosion) override;
};