From 8e8813739971fadc552691dd9a62f4e0863affb4 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Tue, 17 Feb 2026 17:42:34 +0800 Subject: [PATCH] =?UTF-8?q?feat(state):=20=E6=94=AF=E6=8C=81=E5=BC=82?= =?UTF-8?q?=E6=AD=A5=E7=8A=B6=E6=80=81=E9=80=80=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 实现了 IAsyncState 接口的异步退出方法调用 - 添加了对异步状态和普通状态的区分处理 - 确保状态机系统兼容新旧状态类型 - 保持现有同步状态退出逻辑不变 --- GFramework.Core/state/StateMachineSystem.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/GFramework.Core/state/StateMachineSystem.cs b/GFramework.Core/state/StateMachineSystem.cs index 1fbab8e..adde85e 100644 --- a/GFramework.Core/state/StateMachineSystem.cs +++ b/GFramework.Core/state/StateMachineSystem.cs @@ -61,7 +61,15 @@ public class StateMachineSystem : StateMachine, IStateMachineSystem // 退出当前状态 if (Current != null) { - Current.OnExit(null); + if (Current is IAsyncState asyncState) + { + asyncState.OnExitAsync(null); + } + else + { + Current.OnExit(null); + } + Current = null; }