summaryrefslogtreecommitdiff
path: root/Bullet.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Bullet.cs')
-rw-r--r--Bullet.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Bullet.cs b/Bullet.cs
index 9202e3a..6df2903 100644
--- a/Bullet.cs
+++ b/Bullet.cs
@@ -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