using Godot; using System.Collections.Generic; namespace Rokojori { [Tool] [GlobalClass] public partial class FlareVFX:Node3D { [Export] public FlareVFXPreset preset; [Export] public Node3D container; [Export] public bool debug = false; public Node3D GetContainer() { return container == null ? this : container; } List _layers = new List(); [ExportToolButton( "Update Flare" )] public Callable updateFlareButton => Callable.From( ()=> UpdateFlare() ); void UpdateFlare() { if ( debug ) { numLayers = _layers.Count; } _layers.ForEach( l => l.Update( this ) ); } [ExportToolButton( "Create Flare" )] public Callable createFlareButton => Callable.From( ()=> CreateFlare() ); void CreateFlare() { GetContainer().DestroyChildren(); _layers = []; preset.flareLayers.ForEach( ( l )=> { if ( l == null ) { return; } _layers.Add( l.Create( this ) ); } ); UpdateFlare(); } #if TOOLS [Export] public bool editMode = false; [Export] public int numLayers = 0; public override void _Process( double delta ) { // this.LogInfo( "Hello" ); if ( editMode ) { UpdateFlare(); } } #endif } }