This commit is contained in:
CortexCore
2024-11-03 16:38:17 +08:00
parent 056e2cada5
commit 4ba741408d
4693 changed files with 2445 additions and 5443 deletions

View File

@@ -31,7 +31,7 @@ namespace BITKit.StateMachine
void OnStateExit(IState old, IState newState);
}
public interface IStateMachine<T>
public interface IStateMachine<T> where T:IState
{
bool Enabled { get; set; }
T CurrentState { get; set; }
@@ -53,7 +53,7 @@ namespace BITKit.StateMachine
public static class StateMachineUtils
{
public static void Register<T>(IStateMachine<T> stateMachine, T newState) where T : IState
public static void Register<T>(this IStateMachine<T> stateMachine, T newState) where T : IState
{
if (stateMachine.StateDictionary.ContainsKey(newState.GetType()))
{