예제 #1
0
        private FsmBase InternalGetFsm(TypeNamePair typeNamePair)
        {
            FsmBase fsm = null;

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

            return(null);
        }
예제 #2
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);
        }
예제 #3
0
        public IFsm <T> CreateFsm <T>(string name, T owner, List <FsmState <T> > states) where T : class
        {
            TypeNamePair typeNamePair = new TypeNamePair(typeof(T), name);

            if (HasFsm <T>(name))
            {
                throw new Exception(string.Format("Already exist FSM '{0}'.", typeNamePair));
            }

            Fsm <T> fsm = Fsm <T> .Create(name, owner, states);

            m_FsmMap.Add(typeNamePair, fsm);
            return(fsm);
        }
예제 #4
0
 private bool InternalHasFsm(TypeNamePair typeNamePair)
 {
     return(m_FsmMap.ContainsKey(typeNamePair));
 }