rj-action-library/Runtime/Actions/SequenceAction.cs

68 lines
1.1 KiB
C#

using Godot;
namespace Rokojori
{
public class SequenceActionFinishedEvent
{
public int id;
public bool success;
}
[GlobalClass ]
public partial class SequenceAction : Action
{
/*
int dispatchStart();
void dispatchCancelled( int id );
void dispatchEnd( int id );
int getLastSequenceActionID();
GDVIRTUAL1( cancelAction, int );
/* signal onSequenceDone * /
*/
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 )
{
}
}
}