2025-01-08 18:46:17 +00:00
|
|
|
|
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
|
|
|
|
|
|
|
public class SequenceActionFinishedEvent
|
|
|
|
{
|
|
|
|
public int id;
|
|
|
|
public bool success;
|
|
|
|
}
|
|
|
|
|
2025-01-21 20:58:56 +00:00
|
|
|
[GlobalClass, Icon("res://addons/rokojori_action_library/Icons/SequenceAction.svg")]
|
2025-01-08 18:46:17 +00:00
|
|
|
public partial class SequenceAction : Action
|
2025-02-12 16:48:15 +00:00
|
|
|
{
|
2025-01-08 18:46:17 +00:00
|
|
|
int _dispatchCounter = 0;
|
|
|
|
|
|
|
|
public int GetLastSequenceActionID()
|
|
|
|
{
|
|
|
|
return _dispatchCounter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public readonly EventSlot<SequenceActionFinishedEvent> onSequenceDone = new EventSlot<SequenceActionFinishedEvent>();
|
|
|
|
|
|
|
|
public int DispatchStart()
|
|
|
|
{
|
|
|
|
_dispatchCounter ++;
|
|
|
|
return _dispatchCounter;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DispatchEnd( int id )
|
|
|
|
{
|
|
|
|
onSequenceDone.DispatchEvent( new SequenceActionFinishedEvent{ id = id, success = true } );
|
|
|
|
}
|
|
|
|
|
|
|
|
public void DispatchCancelled( int id )
|
|
|
|
{
|
|
|
|
onSequenceDone.DispatchEvent( new SequenceActionFinishedEvent{ id = id, success = false } );
|
|
|
|
}
|
|
|
|
|
|
|
|
public virtual void CancelAction( int id )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|