/// 销毁有限状态机 /// <param name="fsm">需要销毁的有限状态机</param> public bool DestroyFsm(FsmBase fsm) { if (fsm == null) { return(false); } return(InternalDestroyFsm(new TypeNamePair(fsm.ownerType, fsm.fsmName))); }
//字典中获取有限状态机 private FsmBase InternalGetFsm(TypeNamePair typeNamePair) { FsmBase fsm = null; if (mFsmDic.TryGetValue(typeNamePair, out fsm)) { return(fsm); } return(null); }
//字典中移除有限状态机 private bool InternalDestroyFsm(TypeNamePair typeNamePair) { FsmBase fsm = null; if (mFsmDic.TryGetValue(typeNamePair, out fsm)) { fsm.CloseAndClean(); return(mFsmDic.Remove(typeNamePair)); } return(false); }
//获取所有的有限状态机 public FsmBase[] GetAllFsms() { int index = 0; FsmBase[] results = new FsmBase[mFsmDic.Count]; foreach (KeyValuePair <TypeNamePair, FsmBase> fsm in mFsmDic) { results[index++] = fsm.Value; } return(results); }