示例#1
0
        public bool DestroyFsm(FsmBase fsm)
        {
            if (fsm == null)
            {
                throw new Exception("FSM is invalid.");
            }

            return(InternalDestroyFsm(new TypeNamePair(fsm.OwnerType, fsm.Name)));
        }
示例#2
0
        private FsmBase InternalGetFsm(TypeNamePair typeNamePair)
        {
            FsmBase fsm = null;

            if (m_FsmMap.TryGetValue(typeNamePair, out fsm))
            {
                return(fsm);
            }

            return(null);
        }
示例#3
0
        private bool InternalDestroyFsm(TypeNamePair typeNamePair)
        {
            FsmBase fsm = null;

            if (m_FsmMap.TryGetValue(typeNamePair, out fsm))
            {
                fsm.Shutdown();
                return(m_FsmMap.Remove(typeNamePair));
            }

            return(false);
        }
示例#4
0
        public FsmBase[] GetAllFsms()
        {
            int index = 0;

            FsmBase[] results = new FsmBase[m_FsmMap.Count];
            foreach (KeyValuePair <TypeNamePair, FsmBase> fsm in m_FsmMap)
            {
                results[index++] = fsm.Value;
            }

            return(results);
        }