Effect system and snowpea
This commit is contained in:
parent
9b89ae98a6
commit
e797918e23
18 changed files with 353 additions and 16 deletions
|
|
@ -1,5 +1,5 @@
|
|||
using Godot;
|
||||
using System;
|
||||
using Newlon.Systems.Effects;
|
||||
|
||||
namespace Newlon.Components;
|
||||
|
||||
|
|
@ -13,6 +13,8 @@ public partial class LinearProjectile : Area2D, IProjectile
|
|||
private float _speed;
|
||||
[Export]
|
||||
private int _damage;
|
||||
[Export]
|
||||
private Effect _impactEffect;
|
||||
private int _line;
|
||||
public int Line { get => _line; set { _line = value; } }
|
||||
|
||||
|
|
@ -27,6 +29,8 @@ public partial class LinearProjectile : Area2D, IProjectile
|
|||
if (entity != null && entity.Line == _line)
|
||||
{
|
||||
entity.TakeDamage(_damage);
|
||||
if (entity is IEffectHandler effectHandler && _impactEffect != null)
|
||||
effectHandler.GiveEffect(_impactEffect);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue