using System;
using Godot;
using NodeWar.scripts.components;

public partial class Damager : Timer
{
	[Export]
	public float Damage { get; set; } = 1;

	public override void _Ready()
	{
		Timeout += OnTimeout;
	}

	private void OnTimeout()
	{
		var healthComponent = GetParent().GetNode<HealthComponent>("HealthComponent");
		healthComponent?.TakeDamage(Damage);
	}

	public override void _Process(double delta) { }
}
