コード例 #1
0
        // Token: 0x060006F1 RID: 1777 RVA: 0x0001CFF8 File Offset: 0x0001B1F8
        private void SetCameraState(CameraState cameraState)
        {
            this.currentCameraState = cameraState;
            float   d        = (this.localUserViewer == null) ? 1f : this.localUserViewer.userProfile.screenShakeScale;
            Vector3 position = cameraState.position;

            this.rawScreenShakeDisplacement = ShakeEmitter.ComputeTotalShakeAtPoint(cameraState.position);
            Vector3 vector    = this.rawScreenShakeDisplacement * d;
            Vector3 position2 = position + vector;

            if (vector != Vector3.zero)
            {
                Vector3    origin    = position;
                Vector3    direction = vector;
                RaycastHit raycastHit;
                if (Physics.SphereCast(origin, this.sceneCam.nearClipPlane, direction, out raycastHit, vector.magnitude, LayerIndex.world.mask, QueryTriggerInteraction.Ignore))
                {
                    position2 = position + vector.normalized * raycastHit.distance;
                }
            }
            base.transform.SetPositionAndRotation(position2, cameraState.rotation);
            this.currentFov = cameraState.fov;
            if (this.sceneCam)
            {
                this.sceneCam.fieldOfView = this.currentFov;
            }
        }
コード例 #2
0
        // Token: 0x06000BF8 RID: 3064 RVA: 0x0003B0D8 File Offset: 0x000392D8
        private void SetCameraState(CameraState cameraState)
        {
            this.currentCameraState = cameraState;
            float   d        = (this.localUserViewer == null) ? 1f : this.localUserViewer.userProfile.screenShakeScale;
            Vector3 position = cameraState.position;
            Vector3 vector   = ShakeEmitter.ComputeTotalShakeAtPoint(cameraState.position) * d;
            Vector3 vector2  = position + vector;

            if (this.localUserViewer != null)
            {
                Player inputPlayer = this.localUserViewer.inputPlayer;
                if (this.localUserViewer.eventSystem.currentInputSource == MPEventSystem.InputSource.Gamepad)
                {
                    ShakeEmitter.ApplyDeepQuickRumble(this.localUserViewer, vector);
                }
                else
                {
                    inputPlayer.SetVibration(0, 0f);
                    inputPlayer.SetVibration(1, 0f);
                }
            }
            Vector3 position2 = vector2;

            if (vector != Vector3.zero)
            {
                Vector3    origin    = position;
                Vector3    direction = vector;
                RaycastHit raycastHit;
                if (Physics.SphereCast(origin, this.sceneCam.nearClipPlane, direction, out raycastHit, vector.magnitude, LayerIndex.world.mask, QueryTriggerInteraction.Ignore))
                {
                    position2 = position + vector.normalized * raycastHit.distance;
                }
            }
            base.transform.SetPositionAndRotation(position2, cameraState.rotation);
            this.currentFov = cameraState.fov;
            if (this.sceneCam)
            {
                this.sceneCam.fieldOfView = this.currentFov;
            }
        }