init mod
This commit is contained in:
commit
acb9dcaaaf
11 files changed
+510
No files matched your search
@@ -0,0 +1,44 @@
|
||||
using System.Collections.Generic;
|
||||
using Godot;
|
||||
|
||||
namespace Cthangover.Mods.Effects.Animation
|
||||
{
|
||||
/// <summary>
|
||||
/// Editor-configured bridge between a frame Texture2D array and an AnimationController.
|
||||
/// Converts Godot's typed Array into a List, wires the NextCycle event, and starts
|
||||
/// playback. When the animation completes one cycle, it detaches the handler and
|
||||
/// self-destructs — the "fire and forget" glue between artist-authored data and
|
||||
/// the animation runtime.
|
||||
/// </summary>
|
||||
public partial class EffectDataSet : Control
|
||||
{
|
||||
|
||||
[Export] private AnimationController controller;
|
||||
[Export] private Godot.Collections.Array<Texture2D> frameSet;
|
||||
|
||||
/// <summary>Converts the exported frame array, hands it to the controller and starts one playback cycle.</summary>
|
||||
public override void _Ready()
|
||||
{
|
||||
AnchorLeft = 0f;
|
||||
AnchorRight = 1f;
|
||||
AnchorTop = 0f;
|
||||
AnchorBottom = 1f;
|
||||
|
||||
var frames = new List<Texture2D>();
|
||||
foreach (var tex in frameSet)
|
||||
frames.Add(tex);
|
||||
|
||||
controller.Clear();
|
||||
controller.NextCycle += ControllerOnNextCycle;
|
||||
controller.FrameSet = frames;
|
||||
controller.Play();
|
||||
}
|
||||
|
||||
private void ControllerOnNextCycle()
|
||||
{
|
||||
controller.NextCycle -= ControllerOnNextCycle;
|
||||
controller.Clear();
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user