Пример #1
0
        public bool DestroyFsm(FsmBase fsm)
        {
            if (fsm == null)
            {
                Logger.LogError("FSM is invalid.");
            }

            return(InternalDestroyFsm(fsm.OwnerType));
        }
Пример #2
0
        private FsmBase InternalGetFsm(Type type)
        {
            FsmBase tmpFsm = null;

            if (mFsms.TryGetValue(type, out tmpFsm))
            {
                return(tmpFsm);
            }

            return(null);
        }
Пример #3
0
        private bool InternalDestroyFsm(Type type)
        {
            FsmBase tmpFsm = null;

            if (mFsms.TryGetValue(type, out tmpFsm))
            {
                tmpFsm.Shutdown();
                return(mFsms.Remove(type));
            }

            return(false);
        }
Пример #4
0
        public FsmBase[] GetAllFsms()
        {
            int tmpIndex = 0;

            FsmBase[] tmpFsms = new FsmBase[mFsms.Count];
            Dictionary <Type, FsmBase> .Enumerator tmpItor = mFsms.GetEnumerator();
            while (tmpItor.MoveNext())
            {
                tmpFsms[tmpIndex++] = tmpItor.Current.Value;
            }

            return(tmpFsms);
        }