diff --git a/GFramework.Core.Abstractions/state/IStateMachineSystem.cs b/GFramework.Core.Abstractions/state/IStateMachineSystem.cs
new file mode 100644
index 0000000..c31021b
--- /dev/null
+++ b/GFramework.Core.Abstractions/state/IStateMachineSystem.cs
@@ -0,0 +1,9 @@
+using GFramework.Core.Abstractions.system;
+
+namespace GFramework.Core.Abstractions.state;
+
+///
+/// 状态机系统接口,继承自ISystem和IStateMachine接口
+/// 提供状态机系统的功能定义,结合了系统管理和状态机管理的能力
+///
+public interface IStateMachineSystem : ISystem, IStateMachine;
\ No newline at end of file
diff --git a/GFramework.Core.Tests/state/ContextAwareStateMachineTests.cs b/GFramework.Core.Tests/state/StateMachineSystemTests.cs
similarity index 97%
rename from GFramework.Core.Tests/state/ContextAwareStateMachineTests.cs
rename to GFramework.Core.Tests/state/StateMachineSystemTests.cs
index d52d71a..bc28b49 100644
--- a/GFramework.Core.Tests/state/ContextAwareStateMachineTests.cs
+++ b/GFramework.Core.Tests/state/StateMachineSystemTests.cs
@@ -30,7 +30,7 @@ namespace GFramework.Core.Tests.state;
/// - 状态机生命周期完整性
///
[TestFixture]
-public class ContextAwareStateMachineTests
+public class StateMachineSystemTests
{
[SetUp]
public void SetUp()
@@ -43,11 +43,11 @@ public class ContextAwareStateMachineTests
new QueryBus(),
new DefaultEnvironment());
- _stateMachine = new TestContextAwareStateMachineV5();
+ _stateMachine = new TestStateMachineSystemV5();
_stateMachine.SetContext(_context);
}
- private TestContextAwareStateMachineV5? _stateMachine;
+ private TestStateMachineSystemV5? _stateMachine;
private ArchitectureContext? _context;
private EventBus? _eventBus;
@@ -263,7 +263,7 @@ public class ContextAwareStateMachineTests
///
/// 测试用的ContextAwareStateMachine派生类,用于访问内部状态字典
///
-public class TestContextAwareStateMachineV5 : ContextAwareStateMachine
+public class TestStateMachineSystemV5 : StateMachineSystem
{
///
/// 获取状态机内部的状态字典
diff --git a/GFramework.Core/state/ContextAwareStateMachine.cs b/GFramework.Core/state/StateMachineSystem.cs
similarity index 91%
rename from GFramework.Core/state/ContextAwareStateMachine.cs
rename to GFramework.Core/state/StateMachineSystem.cs
index d47fef4..477a356 100644
--- a/GFramework.Core/state/ContextAwareStateMachine.cs
+++ b/GFramework.Core/state/StateMachineSystem.cs
@@ -2,7 +2,6 @@
using GFramework.Core.Abstractions.enums;
using GFramework.Core.Abstractions.rule;
using GFramework.Core.Abstractions.state;
-using GFramework.Core.Abstractions.system;
using GFramework.Core.extensions;
using IDisposable = GFramework.Core.Abstractions.lifecycle.IDisposable;
@@ -12,12 +11,12 @@ namespace GFramework.Core.state;
/// 上下文感知状态机,继承自StateMachine并实现ISystem接口
/// 该状态机能够感知架构上下文,并在状态切换时发送状态变更事件
///
-public class ContextAwareStateMachine : StateMachine, ISystem
+public class StateMachineSystem : StateMachine, IStateMachineSystem
{
///
/// 架构上下文对象,用于提供系统运行所需的上下文信息
///
- protected IArchitectureContext Context = null!;
+ private IArchitectureContext _context = null!;
///
/// 设置架构上下文的方法
@@ -25,7 +24,7 @@ public class ContextAwareStateMachine : StateMachine, ISystem
/// 要设置的架构上下文对象
public void SetContext(IArchitectureContext context)
{
- Context = context;
+ _context = context;
}
///
@@ -34,7 +33,7 @@ public class ContextAwareStateMachine : StateMachine, ISystem
/// 当前的架构上下文对象
public IArchitectureContext GetContext()
{
- return Context;
+ return _context;
}
///
@@ -53,7 +52,7 @@ public class ContextAwareStateMachine : StateMachine, ISystem
{
foreach (var state in States.Values.OfType())
{
- state.SetContext(Context);
+ state.SetContext(_context);
}
}
diff --git a/GFramework.Game/state/GameStateMachine.cs b/GFramework.Game/state/GameStateMachineSystem.cs
similarity index 94%
rename from GFramework.Game/state/GameStateMachine.cs
rename to GFramework.Game/state/GameStateMachineSystem.cs
index 64298e7..42270fa 100644
--- a/GFramework.Game/state/GameStateMachine.cs
+++ b/GFramework.Game/state/GameStateMachineSystem.cs
@@ -6,7 +6,7 @@ namespace GFramework.Game.state;
///
/// 游戏状态机类,继承自ContextAwareStateMachine,用于管理游戏中的各种状态
///
-public sealed class GameStateMachine : ContextAwareStateMachine
+public sealed class GameStateMachineSystem : StateMachineSystem
{
///
/// 检查当前状态是否为指定类型的状态