Ejemplo n.º 1
0
        /// <summary>
        /// 获取所有状态
        /// </summary>
        /// <returns>基础状态数组</returns>
        public BaseFSMState[] GetAllState()
        {
            BaseFSMState[] t_BaseFSMStates = new BaseFSMState[IStateMapDataStructure.Count];
            var            t_StateMaps     = IStateMapDataStructure.ToArray();

            for (int i = 0; i < t_StateMaps.Length; i++)
            {
                t_BaseFSMStates[i] = t_StateMaps[i].Value;
            }
            return(t_BaseFSMStates);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取状态
        /// </summary>
        /// <param name="t_Type">状态的Type类型</param>
        /// <returns>状态的抽象基础状态的实例引用</returns>
        public BaseFSMState GetState(Type t_Type)
        {
            var t_Array = IStateMapDataStructure.ToArray();

            for (int i = 0; i < t_Array.Length; i++)
            {
                if (t_Array[i].Value.GetType() == t_Type)
                {
                    return(t_Array[i].Value as BaseFSMState);
                }
            }
            return(null);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 获取状态
        /// </summary>
        /// <typeparam name="T">状态的类型</typeparam>
        /// <returns>状态的实例</returns>
        public T GetState <T>() where T : BaseFSMState
        {
            var t_Array = IStateMapDataStructure.ToArray();

            for (int i = 0; i < t_Array.Length; i++)
            {
                if (t_Array[i].Value is T)
                {
                    return(t_Array[i].Value as T);
                }
            }
            return(null);
        }