Damage source and effect fix
This commit is contained in:
parent
7aa0aa5bad
commit
c89d93cf24
15 changed files with 52 additions and 34 deletions
|
|
@ -15,8 +15,12 @@ public partial class LinearProjectile : Area2D, IProjectile
|
|||
private int _damage;
|
||||
[Export]
|
||||
private Effect _impactEffect;
|
||||
[Export]
|
||||
private Utility.DamageTypes _damageType = Utility.DamageTypes.PHYSICAL;
|
||||
private int _line;
|
||||
private bool used = false;
|
||||
public int Line { get => _line; set { _line = value; } }
|
||||
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
|
|
@ -25,10 +29,12 @@ public partial class LinearProjectile : Area2D, IProjectile
|
|||
|
||||
public void OnAreaEntered(Area2D area)
|
||||
{
|
||||
if (used == true) return;
|
||||
var entity = area.GetParent<IEntity>();
|
||||
if (entity != null)
|
||||
{
|
||||
entity.TakeDamage(_damage);
|
||||
entity.TakeDamage(_damage,this,_damageType);
|
||||
used = true;
|
||||
if (entity is IEffectHandler effectHandler && _impactEffect != null)
|
||||
effectHandler.GiveEffect(_impactEffect);
|
||||
QueueFree();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue