feat(state): 支持异步状态退出功能

- 实现了 IAsyncState 接口的异步退出方法调用
- 添加了对异步状态和普通状态的区分处理
- 确保状态机系统兼容新旧状态类型
- 保持现有同步状态退出逻辑不变
This commit is contained in:
GeWuYou 2026-02-17 17:42:34 +08:00 committed by gewuyou
parent d76751c636
commit 8e88137399

View File

@ -61,7 +61,15 @@ public class StateMachineSystem : StateMachine, IStateMachineSystem
// 退出当前状态 // 退出当前状态
if (Current != null) if (Current != null)
{ {
Current.OnExit(null); if (Current is IAsyncState asyncState)
{
asyncState.OnExitAsync(null);
}
else
{
Current.OnExit(null);
}
Current = null; Current = null;
} }