コード例 #1
0
ファイル: FSMSystem.cs プロジェクト: TaylorGeGe/GameAIProject
    public void PerformTransition(Transition transition)
    {
        if (transition == Transition.NullTransition)
        {
            Debug.Log("无法执行空的转换条件NullTransition"); return;
        }

        StateID stateID = currentState.GetOutPutState(transition);

        if (stateID == StateID.NullStateID)
        {
            Debug.Log("不需要发生转换" + stateID); return;
        }
        if (states.ContainsKey(stateID) == false)
        {
            Debug.Log("在状态机里面 不包含状态" + stateID + "无法进行转换"); return;
        }
        FSMState state = states[stateID];

        state.DOAdterLeaving();
        currentState = state;
        currentID    = stateID;
        state.DoBeforeEntering();
    }