Beispiel #1
0
 private void UpdateOptions(bool Apply)
 {
     if (configHandler.ContainsSection("Graphic") && configHandler.ContainsSection("Game"))
     {
         DeserializeSettings(Apply);
     }
     else
     {
         QualityDropdown.value          = QualitySettings.GetQualityLevel();
         QualityLevel                   = QualitySettings.GetQualityLevel();
         AntialiasingDropdown.value     = DDAntialiasingLevel(QualitySettings.antiAliasing);
         AnisotropicDropdown.value      = (int)QualitySettings.anisotropicFiltering;
         TextureQualityDropdown.value   = DDTextureQuality(QualitySettings.masterTextureLimit);
         BlendWeightsDropdown.value     = DDBlendWeightsLevel((int)QualitySettings.blendWeights);
         VSyncDropdown.value            = QualitySettings.vSyncCount;
         ShadowResolutionDropdown.value = (int)QualitySettings.shadowResolution;
         ShadowQualityDropdown.value    = (int)QualitySettings.shadows;
         ShadowCascadesDropdown.value   = DDSCascadesLevel(QualitySettings.shadowCascades);
         ShadowProjecionDropdown.value  = (int)QualitySettings.shadowProjection;
         ShadowDistanceSlider.value     = QualitySettings.shadowDistance;
         SerializeGraphic();
         isLoaded = true;
     }
 }
Beispiel #2
0
    void Update()
    {
        if (configHandler && configHandler.ContainsSection("Game") && configHandler.ContainsSectionKey("Game", "Sensitivity"))
        {
            float sensitivity = float.Parse(configHandler.Deserialize("Game", "Sensitivity"));
            if (!(sensitivity == 0))
            {
                if (!(sensitivityX == 0))
                {
                    sensitivityX = sensitivity;
                }
                if (!(sensitivityY == 0))
                {
                    sensitivityY = sensitivity;
                }
            }
        }

        if (Cursor.lockState == CursorLockMode.None)
        {
            return;
        }

        if (axes == RotationAxes.MouseXAndY)
        {
            // Read the mouse input axis
            rotationX += (Input.GetAxis("Mouse X") * sensitivityX / 30 * mainCamera.fieldOfView + offsetX);
            rotationY += (Input.GetAxis("Mouse Y") * sensitivityY / 30 * mainCamera.fieldOfView + offsetY);

            rotationX = ClampAngle(rotationX, minimumX, maximumX);
            rotationY = ClampAngle(rotationY, minimumY, maximumY);

            Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
            Quaternion yQuaternion = Quaternion.AngleAxis(rotationY, Vector3.left);

            if (smoothLook)
            {
                player.transform.localRotation = Quaternion.Slerp(player.transform.localRotation, xQuaternion, smoothTime * Time.deltaTime);
                transform.localRotation        = Quaternion.Slerp(transform.localRotation, yQuaternion, smoothTime * Time.deltaTime);
            }
            else
            {
                player.transform.localRotation = playerOriginalRotation * xQuaternion;
                transform.localRotation        = originalRotation * yQuaternion;
            }
        }
        else if (axes == RotationAxes.MouseX)
        {
            rotationX += (Input.GetAxis("Mouse X") * sensitivityX / 60 * mainCamera.fieldOfView + offsetX);
            rotationX  = ClampAngle(rotationX, minimumX, maximumX);

            Quaternion xQuaternion = Quaternion.AngleAxis(rotationX, Vector3.up);
            transform.localRotation = originalRotation * xQuaternion;
        }
        else
        {
            rotationY += (Input.GetAxis("Mouse Y") * sensitivityY / 60 * mainCamera.fieldOfView + offsetY);
            rotationY  = ClampAngle(rotationY, minimumY, maximumY);

            Quaternion yQuaternion = Quaternion.AngleAxis(rotationY, Vector3.left);
            transform.localRotation = originalRotation * yQuaternion;
        }

        offsetY = 0F;
        offsetX = 0F;
    }