mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-03-25 04:59:01 +08:00
feat(state): 支持异步状态退出功能
- 实现了 IAsyncState 接口的异步退出方法调用 - 添加了对异步状态和普通状态的区分处理 - 确保状态机系统兼容新旧状态类型 - 保持现有同步状态退出逻辑不变
This commit is contained in:
parent
d76751c636
commit
8e88137399
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user