Esempio n. 1
0
        internal void ChangeState(string stateName, object userData = null)
        {
            //string tempStateName = stateName + FsmId.ToString();
            var s = mFsmStateLst.Find(state => ReferenceEquals(state.StateName, stateName));//地址比较的基础是名字字符串是固定地址!!

            if (s != null)
            {
                CurState.OnLeave();
                CurState = s;
                CurState.OnEnter(userData);
            }
            else
            {
                Z.Debug.Error("切换状态机状态失败:未找到对应状态 " + stateName);
            }
        }