AlicizaX/Client/Packages/com.alicizax.unity.fsm/Runtime/Fsm/FsmComponent.cs

34 lines
791 B
C#
Raw Normal View History

2025-01-23 19:06:48 +08:00
using AlicizaX;
using AlicizaX.Fsm;
using System;
using System.Collections.Generic;
using UnityEngine;
namespace AlicizaX.Fsm.Runtime
{
/// <summary>
/// 有限状态机组件。
/// </summary>
[DisallowMultipleComponent]
[AddComponentMenu("Game Framework/FSM")]
2025-04-28 19:45:45 +08:00
public sealed class FsmComponent : MonoBehaviour
2025-01-23 19:06:48 +08:00
{
2025-04-28 19:45:45 +08:00
private IFsmModule _mFsmModule = null;
2025-01-23 19:06:48 +08:00
2025-04-28 19:45:45 +08:00
private void Awake()
2025-01-23 19:06:48 +08:00
{
2025-04-28 19:45:45 +08:00
_mFsmModule = ModuleSystem.RegisterModule<IFsmModule,FsmModule>();
if (_mFsmModule == null)
2025-01-23 19:06:48 +08:00
{
2025-04-28 19:45:45 +08:00
Log.Error("FSM manager is invalid.");
2025-01-23 19:06:48 +08:00
return;
}
}
2025-04-28 19:45:45 +08:00
public List<FsmDebugInfo> GetAllFsmList()
2025-01-23 19:06:48 +08:00
{
2025-04-28 19:45:45 +08:00
return _mFsmModule.GetDebugInfo();
2025-01-23 19:06:48 +08:00
}
}
2025-04-28 19:45:45 +08:00
}