Effect system and snowpea

This commit is contained in:
Фёдор Веселов 2024-10-02 19:46:51 +05:00
commit e797918e23
18 changed files with 353 additions and 16 deletions

View file

@ -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();
}
}