//添加状态到系统
    public void AddState(SoldierState s)
    {
        if (s == null || s.ID == SoldierStateID.NullStateID)
        {
            Debug.LogError("添加状态不能为空");
            return;
        }

        //首次添加状态时,设置系统的初始数据,
        //执行状态的DoBeforeEntering方法
        if (states.Count == 0)
        {
            states.Add(s);
            currentState = s;

            currentState.DoBeforeEntering();
            return;
        }

        if (states.Any(state => state.ID == s.ID))
        {
            Debug.LogError("已经存在 " + s);
            return;
        }

        states.Add(s);
    }
    public void PerformTransition(SoldierTransition tran)
    {
        if (tran == SoldierTransition.NullTransition)
        {
            Debug.Log("要执行的转换条件为空");
        }

        SoldierStateType nextState = mCurrentState.GetTargetStateType(tran);

        if (nextState == SoldierStateType.NullState)
        {
            Debug.Log("在 " + tran + " 条件下,没有对应的目标状态");
            return;
        }

        foreach (SoldierState item in mStates)
        {
            if (item.StateType == nextState)
            {
                mCurrentState.DoBeforeLeaving();
                mCurrentState = item;
                mCurrentState.DoBeforeEntering();
            }
        }
    }