using Godot; using Newlon.Components.Level; namespace Newlon.Components.Plants; // Shoot component of some plants public partial class Shooter : Node2D { [Export] private PackedScene _projectile; [Export] private Timer _timer; private RuntimePlantData _plantData; public override void _Ready() { _plantData = GetParent(); } public void Shoot() { if (_timer.TimeLeft > 0) return; _timer.Start(); var instance = _projectile.Instantiate(); PoolContainer.Instance.Projectiles.AddChild(instance); instance.GlobalTransform = GlobalTransform; if (instance is IProjectile projectile) { projectile.Line = _plantData.Line; } } }