Example #1
0
        public void Start()
        {
            try
            {
                _terrainProperties = FindObjectOfType <TerrainProperties>();

                _noColorOffset = new Vector3(0f, 0f, 0f);
                _defaultGrassFertilityColorOffset = Shader.GetGlobalVector("_GrassFertilityColorOffset");
                _defaultGrassFieldColorOffset     = Shader.GetGlobalVector("_GrassFieldColorOffset");
                _defaultGrassForestColorOffset    = Shader.GetGlobalVector("_GrassForestColorOffset");
                _defaultGrassPollutionColorOffset = Shader.GetGlobalVector("_GrassPollutionColorOffset");
                _defaultWaterColorClean           = Shader.GetGlobalColor("_WaterColorClean");
                _defaultWaterColorDirty           = Shader.GetGlobalColor("_WaterColorDirty");

                _fogProperties = FindObjectOfType <FogProperties>();

                if (_fogProperties != null)
                {
                    _defaultPollutionAmount = _fogProperties.m_PollutionAmount;
                    _defaultFogDensity      = _fogProperties.m_FogDensity;
                    _defaultColorDecay      = _fogProperties.m_ColorDecay;
                }
            }
            catch (Exception e)
            {
                Debug.Log("[Hide It!] ModManager:Start -> Exception: " + e.Message);
            }
        }
 public static void Deploy()
 {
     if (_redirects != null)
     {
         return;
     }
     _redirects              = RedirectionUtil.RedirectType(typeof(WindSpeedExtension));
     fogProperties           = Object.FindObjectOfType <FogProperties>();
     windSpeedBase           = fogProperties.m_WindSpeed;
     dynamicCloudsProperties = Object.FindObjectOfType <DayNightDynamicCloudsProperties>();
     windForceBase           = dynamicCloudsProperties.m_WindForce;
     targetCalm              = 0;
     currentCalm             = 0;
     noCalmCounter           = 0;
     initialized             = true;
 }
Example #3
0
        /*
         * private ScreenSpaceAmbientOcclusion sSAOC;
         * private ScreenSpaceAmbientObscurance sSAOB;
         * private EdgeDetection edgeDetection;
         * private CreaseShading creaseShading;
         */
        /* Fog */

        /*
         * private float m_3DFogAmount = 0f;
         * private float m_3DFogAmountMax = 1f;
         *
         * private float m_3DFogStart  = 0f;
         * private float m_3DFogStartMax = 1f;
         *
         * private float m_3DFogDistance = 0;
         * private float m_3DFogDistanceMax = 100000f;
         *
         * private float m_3DNoiseStepSize = 0f;
         * private float m_3DNoiseStepSizeMax = 120f;
         *
         * private float m_3DNoiseScale = 0;
         * private float m_3DNoiseScaleMax = 1f;
         */
        //Game
        //private bool useButtons;
        //private bool useCollision;
        // Use this for initialization
        void Start()
        {
            //Resolution
            fullScreen = Screen.fullScreen;

            /*
             * //Rendering
             * antiAliasing = QualitySettings.antiAliasing;
             * anisotropicFilt = QualitySettings.anisotropicFiltering;
             * textureQuality = QualitySettings.masterTextureLimit;
             * pixelLightCount = QualitySettings.pixelLightCount;
             * //Shadow
             * shadowProjection = QualitySettings.shadowProjection;
             * shadowDistance = QualitySettings.shadowDistance;
             * shadowCascade = QualitySettings.shadowCascades;
             * //Other
             * vSync = QualitySettings.vSyncCount;
             * particleRaycastBudget = QualitySettings.particleRaycastBudget;
             * frameRate = Application.targetFrameRate;
             *
             * LoDLevel = QualitySettings.maximumLODLevel;
             * LoDBias = QualitySettings.lodBias;*/
            //FPS
            frameUpdateTimer           = new Timer(refreshRateMS);
            frameUpdateTimer.Elapsed  += new ElapsedEventHandler(frameUpdateTimer_Elapsed);
            frameUpdateTimer.AutoReset = true;
            frameUpdateTimer.Start();
            optionWindowRect = new Rect((Screen.width / 2) - (optionWindowRect.width / 2), (Screen.height / 2) - (optionWindowRect.height / 2), optionWindowRect.width, optionWindowRect.height);
            cameraBehaviours = Camera.main.GetComponents <MonoBehaviour>() as MonoBehaviour[];
            //Get MonoBehaviours here.
            foreach (var t in FindObjectsOfType <MonoBehaviour>())
            {
                var properties = t as RenderProperties;
                if (properties != null)
                {
                    this.renderProperties = properties;
                }
                var properties1 = t as DayNightProperties;
                if (properties1 != null)
                {
                    this.dayNightProperties = properties1;
                }
                var properties2 = t as DayNightCloudsProperties;
                if (properties2 != null)
                {
                    this.dayNightCloudsProperties = properties2;
                }
                var properties3 = t as FogProperties;
                if (properties3 != null)
                {
                    this.fogProperties = properties3;
                }
            }

            //m_fogHeight = (float)EUtils.GetFieldValue(renderProperties,"m_fogHeight");

            /*
             * m_fogHeight = (float)EUtils.GetFieldValue(renderProperties,"m_fogHeight");
             * EUtils.SetFieldValue(renderProperties,"m_fogHeight",m_fogHeight);
             *
             * m_edgeFogDistance = (float)EUtils.GetFieldValue(renderProperties,"m_edgeFogDistance");
             * EUtils.SetFieldValue(renderProperties,"m_edgeFogDistance",m_edgeFogDistance);
             *
             * m_useVolumeFog = (bool)EUtils.GetFieldValue(renderProperties,"m_useVolumeFog");
             * EUtils.SetFieldValue(renderProperties,"m_useVolumeFog",m_useVolumeFog);
             *
             * m_volumeFogDensity = (float)EUtils.GetFieldValue(renderProperties,"m_volumeFogDensity");
             * EUtils.SetFieldValue(renderProperties,"m_volumeFogDensity",m_volumeFogDensity);
             *
             * m_volumeFogStart = (float)EUtils.GetFieldValue(renderProperties,"m_volumeFogStart");
             * EUtils.SetFieldValue(renderProperties,"m_volumeFogStart",m_volumeFogStart);
             *
             * m_volumeFogDistance = (float)EUtils.GetFieldValue(renderProperties,"m_volumeFogDistance");
             * EUtils.SetFieldValue(renderProperties,"m_volumeFogDistance",m_volumeFogDistance);
             *
             * m_pollutionFogIntensity = (float)EUtils.GetFieldValue(renderProperties,"m_pollutionFogIntensity");
             * EUtils.SetFieldValue(renderProperties,"m_pollutionFogIntensity",m_pollutionFogIntensity);
             */
            /* Fog */

            /*
             * m_3DFogAmount =  (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DFogAmount");
             * m_3DFogStart  = (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DFogStart");
             * m_3DFogDistance = (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DFogDistance");
             * m_3DNoiseStepSize = (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DNoiseStepSize");
             * m_3DNoiseScale = (float)EUtils.GetFieldValue(GetCameraBehaviour("FogEffect"),"m_3DNoiseScale");
             */

            //Added Effects

            /*
             * sSAOC = Camera.main.gameObject.AddComponent<ScreenSpaceAmbientOcclusion>();
             * sSAOB = Camera.main.gameObject.AddComponent<ScreenSpaceAmbientObscurance>();
             * edgeDetection = Camera.main.gameObject.AddComponent<EdgeDetection>();
             * creaseShading = Camera.main.gameObject.AddComponent<CreaseShading>();
             *
             * sSAOC.enabled = false;
             * sSAOB.enabled = false;
             * edgeDetection.enabled = false;
             * creaseShading.enabled = false;*/


            //QugetFileLoader Alpha.
            filePath = Application.persistentDataPath + "\\qMoreOptionsConfig.qgt";
            QLoader qLoader = new QLoader(filePath);

            qData = qLoader.qData;
            if (qData == null)
            {
                qData = new QData();
            }

            if (qData.GetValueByKey("DONT_REMOVE_THIS") == null)
            {
                //OVERRIDE
                qData.AddToValues("DONT_REMOVE_THIS", "ELSE_IT_RESETS!");
                ResetToDefault();
            }
            else
            {
                //Default
                antiAliasing = Load(saveTag + GetName(new { antiAliasing }));
                //anisotropicFilt = Load(saveTag + GetName (new { anisotropicFilt }));
                float anisoFloat = Load(saveTag + GetName(new { anisotropicFilt }));
                if (anisoFloat == 0)
                {
                    anisotropicFilt = AnisotropicFiltering.Disable;
                }
                if (anisoFloat == 1)
                {
                    anisotropicFilt = AnisotropicFiltering.Enable;
                }
                if (anisoFloat == 2)
                {
                    anisotropicFilt = AnisotropicFiltering.ForceEnable;
                }

                textureQuality  = Load(saveTag + GetName(new { textureQuality }));
                pixelLightCount = Load(saveTag + GetName(new { pixelLightCount }));
                //Shadow
                float shadowProjFloat = Load(saveTag + GetName(new { shadowProjection }));
                if (shadowProjFloat == 0)
                {
                    shadowProjection = ShadowProjection.CloseFit;
                }
                if (shadowProjFloat == 1)
                {
                    shadowProjection = ShadowProjection.StableFit;
                }
                maxShadowDistance = Load(saveTag + GetName(new { shadowDistance = maxShadowDistance }));
                shadowCascade     = Load(saveTag + GetName(new { shadowCascade }));
                //Other
                vSync = Load(saveTag + GetName(new { vSync }));
                particleRaycastBudget = Load(saveTag + GetName(new { particleRaycastBudget }));
                frameRate             = Load(saveTag + GetName(new { frameRate }));

                LoDLevel = Load(saveTag + GetName(new { LoDLevel }));
                LoDBias  = Load(saveTag + GetName(new { LoDBias }));

                //Update
                QualitySettings.antiAliasing         = (int)antiAliasing;
                QualitySettings.anisotropicFiltering = anisotropicFilt;
                QualitySettings.masterTextureLimit   = (int)textureQuality;
                QualitySettings.pixelLightCount      = (int)pixelLightCount;
                //Shadow
                QualitySettings.shadowProjection = shadowProjection;

                QualitySettings.shadowDistance = maxShadowDistance;
                QualitySettings.shadowCascades = (int)shadowCascade;
                //Other
                QualitySettings.vSyncCount            = (int)vSync;
                QualitySettings.particleRaycastBudget = (int)particleRaycastBudget;
                Application.targetFrameRate           = (int)frameRate;

                QualitySettings.maximumLODLevel = (int)LoDLevel;
                QualitySettings.lodBias         = LoDBias;
                //Fog
                BackupFogClassicOptions();
                Configuration.instance.fogClassic = Configuration.defaults.fogClassic;
                SetFogClassicOptions();
            }
        }