diff --git a/GFramework.Core.Abstractions/state/IStateMachine.cs b/GFramework.Core.Abstractions/state/IStateMachine.cs index fa3c130..53b09ed 100644 --- a/GFramework.Core.Abstractions/state/IStateMachine.cs +++ b/GFramework.Core.Abstractions/state/IStateMachine.cs @@ -17,25 +17,12 @@ public interface IStateMachine /// 要注册的状态实例 IStateMachine Register(IState state); - /// - /// 从状态机中注销指定类型的状态 - /// - /// 要注销的状态类型,必须实现IState接口 - IStateMachine Unregister() where T : IState; - /// /// 异步从状态机中注销指定类型的状态 /// /// 要注销的状态类型,必须实现IState接口 Task UnregisterAsync() where T : IState; - /// - /// 检查是否可以切换到指定类型的状态 - /// - /// 目标状态类型,必须实现IState接口 - /// 如果可以切换则返回true,否则返回false - bool CanChangeTo() where T : IState; - /// /// 异步检查是否可以切换到指定类型的状态 /// @@ -43,13 +30,6 @@ public interface IStateMachine /// 如果可以切换则返回true,否则返回false Task CanChangeToAsync() where T : IState; - /// - /// 切换到指定类型的状态 - /// - /// 要切换到的状态类型,必须实现IState接口 - /// 如果成功切换则返回true,否则返回false - bool ChangeTo() where T : IState; - /// /// 异步切换到指定类型的状态 /// @@ -89,12 +69,6 @@ public interface IStateMachine /// 状态历史记录的只读副本 IReadOnlyList GetStateHistory(); - /// - /// 回退到上一个状态 - /// - /// 如果成功回退则返回true,否则返回false - bool GoBack(); - /// /// 异步回退到上一个状态 /// diff --git a/GFramework.Core/state/StateMachine.cs b/GFramework.Core/state/StateMachine.cs index 178dc94..45c6bcf 100644 --- a/GFramework.Core/state/StateMachine.cs +++ b/GFramework.Core/state/StateMachine.cs @@ -39,15 +39,6 @@ public class StateMachine(int maxHistorySize = 10) : IStateMachine return this; } - /// - /// 从状态机中注销指定类型的状态 - /// - /// 要注销的状态类型 - public IStateMachine Unregister() where T : IState - { - return UnregisterAsync().GetAwaiter().GetResult(); - } - /// /// 异步注销指定类型的状态 /// @@ -75,17 +66,6 @@ public class StateMachine(int maxHistorySize = 10) : IStateMachine } } - - /// - /// 检查是否可以切换到指定类型的状态 - /// - /// 目标状态类型 - /// 如果可以切换则返回true,否则返回false - public bool CanChangeTo() where T : IState - { - return CanChangeToAsync().GetAwaiter().GetResult(); - } - /// /// 异步检查是否可以切换到指定类型的状态 /// @@ -110,18 +90,6 @@ public class StateMachine(int maxHistorySize = 10) : IStateMachine } - /// - /// 切换到指定类型的状态 - /// - /// 目标状态类型 - /// 如果成功切换则返回true,否则返回false - /// 当目标状态未注册时抛出 - public bool ChangeTo() where T : IState - { - return ChangeToAsync().GetAwaiter().GetResult(); - } - - /// /// 异步切换到指定类型的状态 /// @@ -216,15 +184,6 @@ public class StateMachine(int maxHistorySize = 10) : IStateMachine } } - /// - /// 回退到上一个状态 - /// - /// 如果成功回退则返回true,否则返回false - public bool GoBack() - { - return GoBackAsync().GetAwaiter().GetResult(); - } - /// /// 异步回退到上一个状态 ///