コード例 #1
0
ファイル: DynamicCamera.cs プロジェクト: solomondg/synthesis
 /// <summary>
 /// Switch to the next camera state
 /// </summary>
 /// <param name="currentCameraState"></param>
 public void ToggleCameraState(CameraState currentCameraState)
 {
     if (MovingEnabled)
     {
         if (currentCameraState.GetType().Equals(typeof(DriverStationState)))
         {
             SwitchCameraState(new OrbitState(this));
         }
         else if (currentCameraState.GetType().Equals(typeof(OrbitState)))
         {
             SwitchCameraState(new FreeroamState(this));
         }
         else if (currentCameraState.GetType().Equals(typeof(FreeroamState)))
         {
             SwitchCameraState(new OverviewState(this));
         }
         else if (currentCameraState.GetType().Equals(typeof(OverviewState)))
         {
             SwitchCameraState(new DriverStationState(this));
         }
     }
     if (_cameraState != null)
     {
         _cameraState.Update();
     }
 }
コード例 #2
0
ファイル: DynamicCamera.cs プロジェクト: solomondg/synthesis
 public void SwitchToState(CameraState targetState)
 {
     if (targetState.GetType().Equals(typeof(DriverStationState)))
     {
         SwitchCameraState(new DriverStationState(this));
     }
     else if (targetState.GetType().Equals(typeof(OrbitState)))
     {
         SwitchCameraState(new OrbitState(this));
     }
     else if (targetState.GetType().Equals(typeof(FreeroamState)))
     {
         SwitchCameraState(new FreeroamState(this));
     }
     else if (targetState.GetType().Equals(typeof(OverviewState)))
     {
         SwitchCameraState(new OverviewState(this));
     }
 }
コード例 #3
0
 /// <summary>
 /// Convert a CameraState to an int from Dropdown value comparison
 /// </summary>
 /// <param name="cameraState"></param>
 /// <returns>A unique integral value depending on the type of state</returns>
 public static int StateToInt(CameraState cameraState)
 {
     if (cameraState.GetType().Equals(typeof(DriverStationState)))
     {
         return(0);
     }
     else if (cameraState.GetType().Equals(typeof(OrbitState)))
     {
         return(1);
     }
     else if (cameraState.GetType().Equals(typeof(FreeroamState)))
     {
         return(2);
     }
     else if (cameraState.GetType().Equals(typeof(OverviewState)))
     {
         return(3);
     }
     throw new Exception("Unhandled CameraState");
 }
コード例 #4
0
ファイル: CameraAI.cs プロジェクト: Ramoniggr/proyectoIA
    public void SetState(CameraState state)
    {
        if (currentState != null)
        {
            currentState.OnStateExit();
        }

        currentState    = state;
        gameObject.name = "Camera - " + state.GetType().Name;

        if (currentState != null)
        {
            currentState.OnStateEnter();
        }
    }
コード例 #5
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();
    }