rokojori_action_library/Runtime/Behavior/Fight/FightSlot.cs

49 lines
608 B
C#
Raw Normal View History

using Godot;
using Rokojori.Extensions;
namespace Rokojori;
[Tool]
[GlobalClass]
public partial class FightSlot:Node
{
[Export]
public float priority = 0;
bool _joined = false;
public void Join()
{
if ( _joined )
{
return;
}
var manager = FightManager.Get();
if ( manager == null )
{
return;
}
manager.Register( this );
_joined = true;
}
public void Leave()
{
if ( ! _joined )
{
return;
}
FightManager.Get()?.Unregister( this );
_joined = false;
}
public override void _ExitTree()
{
Leave();
}
}