79 lines
1.4 KiB
C#
79 lines
1.4 KiB
C#
using Godot;
|
|
using System.Collections.Generic;
|
|
|
|
using Rokojori.Extensions;
|
|
namespace Rokojori;
|
|
|
|
[Tool]
|
|
[GlobalClass ]
|
|
public partial class EmberVFXPreset:ParticleVFXPreset
|
|
{
|
|
[Export]
|
|
public Color color;
|
|
|
|
[Export]
|
|
public float colorIntensity = 1f ;
|
|
|
|
|
|
[Export]
|
|
public Gradient gradient;
|
|
|
|
[Export]
|
|
public float meshScale = 1f;
|
|
|
|
|
|
[Export]
|
|
public ParticleVFXVolumeType volume = new SphereParticleVFXVolumeType();
|
|
|
|
[Export]
|
|
public ParticleVFXMovementType movement = new LinearParticleVFXMovementType();
|
|
|
|
public override void Initialize( ParticleVFX vfx )
|
|
{
|
|
vfx.DestroyChildren();
|
|
|
|
var data = new EmberVFXData();
|
|
data.preset = this;
|
|
data.Assign( vfx );
|
|
}
|
|
|
|
public override void Play( ParticleVFX vfx )
|
|
{
|
|
var data = vfx.GetDataAs<EmberVFXData>();
|
|
|
|
if ( data == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
data.Play( vfx );
|
|
}
|
|
|
|
public override void UpdateSettings( ParticleVFX vfx )
|
|
{
|
|
|
|
var data = vfx.GetDataAs<EmberVFXData>();
|
|
|
|
if ( data == null )
|
|
{
|
|
return;
|
|
}
|
|
|
|
if ( ! GodotObject.IsInstanceValid( data.particles ) )
|
|
{
|
|
Initialize( vfx );
|
|
}
|
|
|
|
data.UpdateSettings( vfx );
|
|
}
|
|
|
|
#if TOOLS
|
|
public override void DrawGizmo( ParticleVFX vfx, EditorNode3DGizmoPlugin gizmoPlugin, EditorNode3DGizmo gizmo )
|
|
{
|
|
var data = vfx.GetDataAs<EmberVFXData>();
|
|
|
|
data?.DrawGizmo( vfx, gizmoPlugin, gizmo );
|
|
}
|
|
#endif
|
|
|
|
} |