Exemple #1
0
    //切换状态
    public void ChangeState <T>() where T : PlayerStateBase
    {
        //旧状态离开回调
        if (currentState != null)
        {
            currentState.OnExit();
        }

        currentState = states[typeof(T)]; //切换状态

        currentState.OnEnter();           //新状态进入回调

        //Debug.Log("进入" + CurrentState.PlayerState);
    }
Exemple #2
0
 // ステート変更
 private void ChangeState(PlayerStateBase nextState)
 {
     currentState.OnExit(this, nextState);
     nextState.OnEnter(this, currentState);
     currentState = nextState;
 }