Exemple #1
0
 /// <summary>
 /// 移除状态
 /// </summary>
 /// <param name="t_StateType">状态类型</param>
 public void RemoveState(Type t_StateType)
 {
     IStateMapDataStructure.Foreach((key, value) => {
         if (value.GetType() == t_StateType)
         {
             IStateMapDataStructure.Remove(key);
             value.OnStateDestroy(this);
         }
     });
 }
Exemple #2
0
 /// <summary>
 /// 移除状态
 /// </summary>
 /// <typeparam name="T">状态类型</typeparam>
 public void RemoveState <T>() where T : BaseFSMState
 {
     IStateMapDataStructure.Foreach((key, value) => {
         if (value is T)
         {
             IStateMapDataStructure.Remove(key);
             value.OnStateDestroy(this);
         }
     });
 }
Exemple #3
0
 /// <summary>
 /// 更改状态机状态
 /// </summary>
 /// <param name="t_StateType"></param>
 public void ChangeState(Type t_StateType)
 {
     if (IsRunning)
     {
         IStateMapDataStructure.Foreach((key, value) => {
             if (value.GetType() == t_StateType)
             {
                 m_TempState = value;
             }
         });
     }
 }
Exemple #4
0
 /// <summary>
 /// 更改状态机状态
 /// </summary>
 /// <param name="t_StateName">状态的名字</param>
 public void ChangeState(string t_StateName)
 {
     if (IsRunning)
     {
         IStateMapDataStructure.Foreach((key, value) => {
             if (key == t_StateName)
             {
                 m_TempState = value;
             }
         });
     }
 }
Exemple #5
0
 /// <summary>
 /// 更改状态机状态
 /// </summary>
 /// <param name="t_BaseFSMState">更改的目标状态</param>
 public void ChangeState(BaseFSMState t_BaseFSMState)
 {
     if (IsRunning)
     {
         IStateMapDataStructure.Foreach((key, value) => {
             if (value.Equals(t_BaseFSMState))
             {
                 m_TempState = value;
             }
         });
     }
 }
Exemple #6
0
        /// <summary>
        /// 状态机被销毁
        /// </summary>
        /// <param name="t_IModuleManager">状态机模块的管家</param>
        protected internal override void OnDestroy(IFSMOwner t_IFSMOwner)
        {
            //TODO:状态机被销毁后

            IsRunning = false;

            //销毁所有的状态
            IStateMapDataStructure.Foreach((key, value) => {
                value.OnStateDestroy(this);
            });
            IStateMapDataStructure.Clear();

            //销毁所有的条件
            IConditionMapDataStructure.Foreach((key, value) => {
                value.OnConditionDestroy(this);
            });
            IConditionMapDataStructure.Clear();
        }