예제 #1
0
    private void SwitchCamMode(CameraMode mode, CameraContext context = null)
    {
        if (cameraControlModeParam == null || curCameraModeParam == null)
        {
            return;
        }
        CameraMode oldMode = cameraMode;

        cameraMode = mode;  //保证外部拿到的cameraMode是当前的?

        if (camCtrl != null)
        {
            if (camCtrl.GetCameraMode() == mode)    //同一个状态不能重复进入
            {
                return;
            }
            curCameraModeParam.FOV               = m_userDesireFov;
            curCameraModeParam.curPitchAngle     = m_userDesireAngle.x;
            curCameraModeParam.curDistance       = m_userDesireDistance;
            cameraControlModeParam[(int)oldMode] = curCameraModeParam;
            camCtrl.Leave();
        }
        camCtrl = CameraUtil.GetCamCtrl(mode);
        camCtrl.curCameraMode = mode;
        curCameraModeParam    = cameraControlModeParam[(int)mode];
        camCtrl.Enter(context);
    }
예제 #2
0
    //外部状态强制切换
    private void HandleModeForceSwitch(CameraMode mode, CameraContext context = null)
    {
        if (!Reset(false))
        {
            return;
        }
        BaseCameraController camCtrl = CameraUtil.GetCamCtrl(mode);

        if (camCtrl.Enable(false) && camCtrl.CheckContext(context))
        {
            SwitchCamMode(mode, context);
        }
    }
예제 #3
0
 //内部状态切换
 private void RefreshCameraMode(CameraContext context = null)
 {
     if (!Reset(false))
     {
         return;
     }
     for (int i = 0; i < camCtrl.AllowChangeList.Count; i++)
     {
         BaseCameraController canCtrl = CameraUtil.GetCamCtrl(camCtrl.AllowChangeList[i]);
         if (canCtrl.Enable(true) && canCtrl.CheckContext(context))
         {
             SwitchCamMode(camCtrl.AllowChangeList[i], context);
             break;
         }
     }
 }