/// <summary> /// 响应有限状态机事件时调用。 /// </summary> /// <param name="fsm">有限状态机引用。</param> /// <param name="sender">事件源。</param> /// <param name="eventId">事件编号。</param> /// <param name="userData">用户自定义数据。</param> internal void OnEvent(IFsm <T> fsm, object sender, int eventId, object userData) { FsmEventHandler <T> eventHandlers = null; if (m_EventHandlers.TryGetValue(eventId, out eventHandlers)) { eventHandlers?.Invoke(fsm, sender, userData); } }
internal virtual void OnEvent(Fsm <T> fsm, object sender, int eventId, object userData) { FsmEventHandler <T> fsmEvent = null; if (_events.TryGetValue(eventId, out fsmEvent)) { fsmEvent?.Invoke(fsm, sender, userData); } }