diff options
Diffstat (limited to 'Bullet.cs')
| -rw-r--r-- | Bullet.cs | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -6,6 +6,7 @@ public partial class Bullet : Area2D [Export] public float Speed { get; set; } = 600.0f; [Export] public float Damage { get; set; } = 10.0f; public bool PierceEntity { get; set; } = false; + public int EntityPierceCount { get; set; } = 0; public bool PierceTerrain { get; set; } = false; public bool ricochet { get; set; } = true; public int BounceLimit { get; set; } = 5; @@ -62,11 +63,19 @@ public partial class Bullet : Area2D if (collider is IDamageable target) { target.TakeDamage(Damage); - if (!PierceEntity) + + bool canPierceEntity = PierceEntity || EntityPierceCount > 0; + if (!canPierceEntity) { QueueFree(); return; } + + if (!PierceEntity && EntityPierceCount > 0) + { + EntityPierceCount--; + } + GlobalPosition = hitPos + Direction * 0.1f; } else |
