This commit is contained in:
陈思海 2025-09-29 15:07:07 +08:00
parent a5c92a0f69
commit 8f5a88e1f5

View File

@ -3,7 +3,7 @@ using System.Runtime.CompilerServices;
using AlicizaX; using AlicizaX;
public interface IState : IMemory public interface IState
{ {
IUltraFSM Fsm { get; set; } IUltraFSM Fsm { get; set; }
bool IsRegistered { get; set; } bool IsRegistered { get; set; }
@ -16,13 +16,6 @@ public interface IState : IMemory
public abstract class StateBase<TState> : IState where TState : Enum public abstract class StateBase<TState> : IState where TState : Enum
{ {
public void Clear()
{
IsRegistered = false;
Fsm = null;
}
public bool fromPool { get; set; }
public IUltraFSM Fsm { get; set; } public IUltraFSM Fsm { get; set; }
public bool IsRegistered { get; set; } public bool IsRegistered { get; set; }
@ -160,7 +153,7 @@ public sealed class SimpleFSM<TState> : IUltraFSM where TState : Enum
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public void Register<T>(TState stateId) where T : class, IMemory, IState, new() public void Register<T>(TState stateId) where T : class, IState, new()
{ {
int stateIdValue = Convert.ToInt32(stateId); int stateIdValue = Convert.ToInt32(stateId);
if (stateIdValue < 0) if (stateIdValue < 0)
@ -174,7 +167,6 @@ public sealed class SimpleFSM<TState> : IUltraFSM where TState : Enum
if (existingState != null && existingState.IsRegistered) if (existingState != null && existingState.IsRegistered)
{ {
existingState.Destroy(); existingState.Destroy();
MemoryPool.Release(existingState);
_registeredCount--; _registeredCount--;
} }