using Godot;
using Newlon.Components.Zombies;

public partial class ZombieKillHandler : Node
{
	[Export] private AnimationTree _tree;
	[Export] private CollisionShape2D _collider;
	private void OnKilled(RuntimeZombieData who)
	{
		var tween = CreateTween();
		tween.TweenInterval(4.0);
		tween.TweenCallback(Callable.From(() =>
		{
			((AnimationNodeStateMachinePlayback)_tree.Get("parameters/Tree/playback")).Travel("Death");
			_collider.Disabled = true;
		}));
		tween.TweenInterval(3.0);
		tween.TweenProperty(who, "modulate",new Color(1, 1, 1, 0),1.0);
		tween.TweenCallback(Callable.From(() =>
		{
			who.Kill();
		}));
	}
}
