예제 #1
0
 /// 销毁有限状态机
 /// <param name="fsm">需要销毁的有限状态机</param>
 public bool DestroyFsm(FsmBase fsm)
 {
     if (fsm == null)
     {
         return(false);
     }
     return(InternalDestroyFsm(new TypeNamePair(fsm.ownerType, fsm.fsmName)));
 }
예제 #2
0
        //字典中获取有限状态机
        private FsmBase InternalGetFsm(TypeNamePair typeNamePair)
        {
            FsmBase fsm = null;

            if (mFsmDic.TryGetValue(typeNamePair, out fsm))
            {
                return(fsm);
            }
            return(null);
        }
예제 #3
0
        //字典中移除有限状态机
        private bool InternalDestroyFsm(TypeNamePair typeNamePair)
        {
            FsmBase fsm = null;

            if (mFsmDic.TryGetValue(typeNamePair, out fsm))
            {
                fsm.CloseAndClean();
                return(mFsmDic.Remove(typeNamePair));
            }
            return(false);
        }
예제 #4
0
        //获取所有的有限状态机
        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);
        }