Effects/PreparedEffects.cs
namespace PlanetMeat;
[Group( "Planet Meat - Effects" ), Title( "Prepared Effects" ), Icon( "border_outer" )]
public sealed class PreparedEffects : Component
{
[Property] private List<GameObject> Effects { get; set; } = [];
[Property] private List<SoundEvent> Sounds { get; set; } = [];
[Property] private float DefaultRadius { get; set; } = 100.0f;
public void PerformEffects( float radius )
{
foreach ( var e in Effects )
{
if ( e is GameObject p && p.Clone( WorldPosition ).Components.Get<ScaledEffect>() is ScaledEffect s )
s.ScaleTo( radius );
}
if ( Sounds.Count > 0 )
SoundEffectsBundle.Create( WorldPosition, Sounds );
}
public void PerformEffects() => PerformEffects( DefaultRadius );
}