コード例 #1
0
    public void ChangeState(CameraState newState)
    {
        if (currentState != null)
        {
            currentState.Exit();
        }

        currentState = newState;
        currentState.Enter();
    }
コード例 #2
0
    public void setState(string stateName)
    {
        if (stateDic.ContainsKey(stateName) == false)
        {
            return;
        }
        CameraState aimState = stateDic[stateName];

        if (currentState != null)//currentMode != aimMode//新旧状态可以相同
        {
            Debug.Log(currentState.GetType().Name + " Exit()");
            currentState.Exit();
        }
        currentState = aimState;
        Debug.Log(aimState.GetType().Name + " Enter()");
        aimState.Enter();
    }
コード例 #3
0
 public void ChangeState(CameraState newState)
 {
     CurrentState.Exit();
     CurrentState = newState;
     CurrentState.Enter();
 }
コード例 #4
0
 public void Initialize(CameraState startingState)
 {
     CurrentState = startingState;
     CurrentState.Enter();
 }