Effects/ScaledEffect.cs
namespace PlanetMeat;
[Group( "Planet Meat - Effects" ), Title( "Scaled Effect" ), Icon( "open_in_new" )]
public sealed class ScaledEffect : Component
{
[Property] public float BaseSize { get; set; } = 100.0f;
public void ScaleTo( float size )
{
WorldScale = size / BaseSize;
}
public static GameObject TryCreateAndScale( GameObject prefab, Vector3 worldPosition, float radius )
{
var fxGo = prefab?.Clone( worldPosition );
if ( fxGo is GameObject g && g.Components.Get<ScaledEffect>() is ScaledEffect scaled )
scaled.ScaleTo( radius );
return fxGo;
}
}