Effects/GroupDestroyer.cs
namespace PlanetMeat;

[Group( "Planet Meat - Effects" ), Title( "Group Destroyer" ), Icon( "group_off" )]
public sealed class GroupDestroyer : Component
{
	[Property] public List<GameObject> DestroyTargets { get; set; } = [];

	protected override void OnDestroy()
	{
		foreach ( var go in DestroyTargets.Where( t => t?.IsValid ?? false ) )
			go.Destroy();
		base.OnDestroy();
	}

	public void AlsoDestroy( GameObject go ) => DestroyTargets.Add( go );
}