예제 #1
0
    /// <summary>
    /// 切换相机方式一,直接参数切换
    /// </summary>
    public void ChangeCamera(CameraUniversal targetCamera, float mTimeUseFly = 2)
    {
        AddCameraToGroup(targetCamera);

        if (targetCamera != null && targetCamera != currentCamera)
        {
            Debug.Log("ChangeCamera");
            lastCamera = currentCamera;

//          if (currentCamera == null)
//          currentCamera = targetCamera;

            if (currentCamera.playAnimationPath)
            {
                currentCamera.CameraPathStopPlay();
            }

            string currentState = currentCamera.DisableCamera();

            targetCamera.EnableCamera();

//          Vector3 toPos = targetCamera.transform.position;
//          Debug.Log(Vector3.Distance(toPos, lastCamera.transform.position));
//          Quaternion toRo = targetCamera.transform.localRotation;

            targetCamera.SetCameraPositionAndXYZCount(currentState, 0);
            targetCamera.DisableCameraCtrl();
            targetCamera.MoveToInitPosition(mTimeUseFly);

            currentCamera = targetCamera;
//          RemoteGather.currentCameraUniversal = currentCamera;
//          Debug.Log(2222);
            RemoteGather.lastSendCameraCameraState = currentCamera.GetCameraState();
        }
    }
예제 #2
0
    public void RenderSenceThumbnail(RenderTexture renderTexture, SenceInteractiveInfo needRenderScene, CameraUniversal cameraThumbnail, string cameraArgs = "")
    {
        bool orginDisplayState = false;

        if (needRenderScene.sceneType == SenceInteractiveInfo.SceneType.大场景)
        {
            orginDisplayState = needRenderScene.meshRoot.gameObject.activeInHierarchy;
            needRenderScene.meshRoot.gameObject.SetActive(true);
        }
        else
        {
            if (needRenderScene.huXingType.hxMeshRoot != null)
            {
                orginDisplayState = needRenderScene.huXingType.hxMeshRoot.gameObject.activeInHierarchy;
                needRenderScene.huXingType.hxMeshRoot.gameObject.SetActive(true);
            }
        }

        cameraThumbnail.GetComponent <Camera>().targetTexture = renderTexture;
        cameraThumbnail.EnableCamera();
        if (cameraArgs != "")
        {
            cameraThumbnail.SetCameraPositionAndXYZCount(cameraArgs, 0);
        }
        cameraThumbnail.GetComponent <Camera>().Render();
        cameraThumbnail.DisableCamera();
        cameraThumbnail.GetComponent <Camera>().targetTexture = null;

        if (needRenderScene.sceneType == SenceInteractiveInfo.SceneType.大场景)
        {
            needRenderScene.meshRoot.gameObject.SetActive(orginDisplayState);
        }
        else
        {
            if (needRenderScene.huXingType.hxMeshRoot != null)
            {
                needRenderScene.huXingType.hxMeshRoot.gameObject.SetActive(orginDisplayState);
            }
        }
    }