Effects handling rework
This commit is contained in:
parent
08d593175b
commit
63930450a3
21 changed files with 100 additions and 228 deletions
|
|
@ -17,8 +17,6 @@ public partial class LinearProjectile : Area2D, IProjectile
|
|||
[Export]
|
||||
private Effect _impactEffect;
|
||||
[Export]
|
||||
private Utility.DamageTypes _damageType = Utility.DamageTypes.PHYSICAL;
|
||||
[Export]
|
||||
private PackedScene particles;
|
||||
private int _line;
|
||||
private bool used = false;
|
||||
|
|
@ -33,13 +31,13 @@ public partial class LinearProjectile : Area2D, IProjectile
|
|||
public void OnAreaEntered(Area2D area)
|
||||
{
|
||||
if (used == true) return;
|
||||
var entity = area.GetParent<IEntity>();
|
||||
var entity = area.GetParent<Entity>();
|
||||
if (entity != null)
|
||||
{
|
||||
entity.TakeDamage(_damage,this,_damageType);
|
||||
entity.TakeDamage(_damage,this);
|
||||
used = true;
|
||||
if (entity is IEffectHandler effectHandler && _impactEffect != null)
|
||||
effectHandler.GiveEffect(_impactEffect);
|
||||
if (_impactEffect != null)
|
||||
entity.GiveEffect(_impactEffect);
|
||||
|
||||
PoolContainer.Instance.SpawnParticles(particles, GlobalPosition);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue