using Godot; using NodeWar.Scripts; namespace NodeWar.scripts.components; public partial class SpawnerComponent : Node { [Export] public PackedScene Spawnee; [Export] public Faction Faction; [Export] public float BuildSpeed = 28; [Export] public float BuildProgress = 0; [Export] public float MaxBuildProgress = 100; public Vector2 Target { get; set; } public override void _Ready() { } public override void _Process(double delta) { BuildProgress += BuildSpeed * delta.ToFloat(); if (BuildProgress >= MaxBuildProgress) { BuildProgress = 0; var pip = Spawnee.Instantiate(); pip.Faction = Faction; pip.Target = Target; GetParent().AddChild(pip); pip.GlobalPosition = GetParent().GlobalPosition; } } }