/// <summary> /// 销毁有限状态机 /// </summary> /// <param name="fsm">要销毁的有限状态机</param> /// <returns>是否销毁有限状态机成功</returns> public bool DestroyFsm(FsmBase fsm) { if (fsm == null) { throw new Exception("FSM is invalid."); } return(InternalDestroyFsm(TextUtil.GetFullName(fsm.OwnerType, fsm.Name))); }
private FsmBase InternalGetFsm(string fullName) { FsmBase fsm = null; if (m_Fsms.TryGetValue(fullName, out fsm)) { return(fsm); } return(null); }
/// <summary> /// 获取所有有限状态机 /// </summary> /// <returns>所有有限状态机</returns> public FsmBase[] GetAllFsms() { int index = 0; FsmBase[] results = new FsmBase[m_Fsms.Count]; foreach (KeyValuePair <string, FsmBase> fsm in m_Fsms) { results[index++] = fsm.Value; } return(results); }
private bool InternalDestroyFsm(string fullName) { FsmBase fsm = null; if (m_Fsms.TryGetValue(fullName, out fsm)) { fsm.Shutdown(); return(m_Fsms.Remove(fullName)); } return(false); }
/// <summary> /// 销毁有限状态机 /// </summary> /// <param name="fsm">要销毁的有限状态机</param> /// <returns>是否销毁有限状态机成功</returns> public bool DestroyFsm(FsmBase fsm) { return(m_FsmManager.DestroyFsm(fsm)); }