aloe effect

This commit is contained in:
Rendo 2025-07-30 03:52:34 +05:00
commit 5a6eb151ae
7 changed files with 212 additions and 70 deletions

View file

@ -8,12 +8,13 @@ public partial class AloeBehaviour : BaseBehaviour
[Export] private float _hpTreshold = 0.25f;
private Timer _timer;
private bool _charge = true;
private PackedScene particlesPacked = ResourceLoader.Load<PackedScene>("uid://b3na62o5pu1gt");
public override void _Ready()
{
{
base._Ready();
_timer = GetNode<Timer>("Timer");
}
_timer = GetNode<Timer>("Timer");
}
public override void _Process(double delta)
{
@ -34,9 +35,12 @@ public partial class AloeBehaviour : BaseBehaviour
public void Heal()
{
var checkPos = GetParent<Node2D>().GlobalPosition + Vector2.Right * FieldParams.TileWidth;
if (PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData))
{
plantData.Heal(300, GetParent());
if (PoolContainer.Instance.TryGetEntity(checkPos, out RuntimePlantData plantData))
{
plantData.Heal(300, GetParent());
var particles = particlesPacked.Instantiate<Node2D>();
PoolContainer.Instance.Particles.AddChild(particles);
particles.GlobalPosition = plantData.GlobalPosition;
}
}