Exemplo n.º 1
0
        internal static bool Prefix(UniStormWeatherSystem __instance)
        {
            if (!Solstice_RV.isEnabled)
            {
                return(true);
            }

            float lat = Solstice_RV.Latitude;

            float sunAngle = __instance.m_SunAngle;

            Transform transform  = __instance.m_SunLight.transform;
            Vector3   suntoearth = new Vector3(0, 0, 1f);
            float     zenith     = sunAngle;

            suntoearth = Quaternion.Euler(zenith, 0, 0) * suntoearth;

            transform.forward = suntoearth;

            Vector3 earth_axis = new Vector3(0, 0, 1);

            earth_axis = Quaternion.Euler(-lat, 0, 0) * earth_axis;

            transform.Rotate(earth_axis, __instance.m_NormalizedTime * 360f - 180f, Space.World);

            return(false);
        }
Exemplo n.º 2
0
        private static void Clouds()
        {
            UniStormWeatherSystem uniStorm = GameManager.GetUniStorm();

            Debug.Log(DumpUtils.FormatGameObject("m_lightClouds1", uniStorm.m_LightClouds1));
            Debug.Log(DumpUtils.FormatGameObject("m_lightClouds2", uniStorm.m_LightClouds2));
            Debug.Log(DumpUtils.FormatGameObject("m_HighClouds1", uniStorm.m_HighClouds1));
            Debug.Log(DumpUtils.FormatGameObject("m_MostlyCloudyClouds", uniStorm.m_MostlyCloudyClouds));
        }
Exemplo n.º 3
0
            public static void Postfix(UniStormWeatherSystem __instance)
            {
                if (__instance.m_SunLight == null || __instance.m_SunLight.transform == null || GameLights.theSun == null || !Settings.options.trueSun)
                {
                    return;
                }

                GameLights.theSun.transform.rotation  = Quaternion.AngleAxis(GameLights.sunOffset - 90f, Vector3.up);
                GameLights.theSun.transform.rotation *= Quaternion.AngleAxis(__instance.m_NormalizedTime * 360f - 90f - __instance.m_MasterTimeKeyOffset * 15f, Vector3.right + Vector3.up * __instance.m_SunAngle * 0.1f);
            }
Exemplo n.º 4
0
        private int GetPhaseTextureIndex()
        {
            if (forcedPhase >= 0)
            {
                return(forcedPhase);
            }

            UniStormWeatherSystem uniStormWeatherSystem = GameManager.GetUniStorm();
            int day = uniStormWeatherSystem.GetDayNumber() + uniStormWeatherSystem.m_MoonCycleStartDay;

            return(day % MOON_CYCLE_DAYS * MoonPhaseTextures.Length / MOON_CYCLE_DAYS);
        }
Exemplo n.º 5
0
        private static void UniStorm()
        {
            UniStormWeatherSystem uniStormWeatherSystem = GameManager.GetUniStorm();
            GameObject            starSphere            = uniStormWeatherSystem.m_StarSphere;

            Debug.Log(DumpUtils.FormatGameObject("starSphere", starSphere));

            ObjExporter.DoExport(starSphere, true);

            Renderer starSphereRenderer = starSphere.GetComponent <Renderer>();
            Material material           = starSphereRenderer.material;

            Debug.Log(DumpUtils.FormatValue("material", material));
            Debug.Log(DumpUtils.FormatValue("mainTexture", material.mainTexture));
        }
Exemplo n.º 6
0
        internal static void GetCurrentPeriodAndWeather()
        {
            UniStormWeatherSystem uniStorm    = GameManager.GetUniStorm();
            TODBlendState         periodState = uniStorm.GetTODBlendState();

            currentPeriodPct = uniStorm.GetTODBlendPercent(periodState);

            switch (periodState)
            {
            case TODBlendState.NightStartToNightEnd:
                currentPeriod = "night";
                break;

            case TODBlendState.NightEndToDawn:
                currentPeriod = "early_dawn";
                break;

            case TODBlendState.DawnToMorning:
                currentPeriod = "dawn";
                break;

            case TODBlendState.MorningToMidday:
                currentPeriod = "morning";
                break;

            case TODBlendState.MiddayToAfternoon:
                currentPeriod = "afternoon";
                break;

            case TODBlendState.AfternoonToDusk:
                currentPeriod = "dusk";
                break;

            case TODBlendState.DuskToNightStart:
                currentPeriod = "after_dusk";
                break;
            }

            float transTime        = uniStorm.m_WeatherTransitionTime;
            float transTimeElapsed = uniStorm.m_SecondsSinceLastWeatherChange;

            currentWeatherPct = Mathf.Clamp01(transTimeElapsed / transTime);

            Weather wth = GameManager.GetWeatherComponent();

            currentWeather  = GetWeatherStageName(wth.GetWeatherStage());
            previousWeather = GetWeatherStageName(uniStorm.m_PreviousWeatherStage);
        }
Exemplo n.º 7
0
        public static void Postfix(UniStormWeatherSystem __instance)
        {
            foreach (WeatherStateConfig eachWeatherStateConfig in __instance.m_WeatherStateConfigs)
            {
                if (eachWeatherStateConfig == null)
                {
                    continue;
                }

                DisableChromaticAberration(eachWeatherStateConfig.m_AfternoonColors);
                DisableChromaticAberration(eachWeatherStateConfig.m_DawnColors);
                DisableChromaticAberration(eachWeatherStateConfig.m_DuskColors);
                DisableChromaticAberration(eachWeatherStateConfig.m_MiddayColors);
                DisableChromaticAberration(eachWeatherStateConfig.m_MorningColors);
                DisableChromaticAberration(eachWeatherStateConfig.m_NightColors);
            }
        }
Exemplo n.º 8
0
 internal static void Prefix(UniStormWeatherSystem __instance)
 {
     Solstice_RV.Update();
 }
Exemplo n.º 9
0
 internal static void Postfix(UniStormWeatherSystem __instance)
 {
     Solstice_RV.Init(__instance);
 }
Exemplo n.º 10
0
 public static void Postfix(UniStormWeatherSystem __instance)
 {
     AmbientLights.weatherInit = true;
     AmbientLights.MaybeUpdateLightsToPeriod(true);
 }
Exemplo n.º 11
0
        internal LightSet GetCurrentLightSet()
        {
            if (data == null)
            {
                return(null);
            }

            TimeWeather.GetCurrentPeriodAndWeather();

            LightSet ls = new LightSet();

            UniStormWeatherSystem uniStorm = GameManager.GetUniStorm();
            TODStateConfig        state    = uniStorm.GetActiveTODState();

            AmbPeriod prd = GetPeriodSet();

            //Base Colors
            Color baseSun = state.m_SunLight;
            Color origSun = state.m_SunLight;
            Color baseFog = state.m_FogColor;
            Color origFog = state.m_FogColor;

            baseSun.a = 1;
            baseFog.a = 1;

            float auroraFade = GameManager.GetAuroraManager().GetNormalizedAlphaSquare();

            if (Mathf.Abs(auroraFade) > 0.0001f)
            {
                Color    auroraColour   = GameManager.GetAuroraManager().GetAuroraColour();
                ColorHSV auroraModColor = auroraColour;

                if (!GameManager.GetAuroraManager().IsUsingCinematicColours())
                {
                    auroraModColor.s *= Settings.options.auroraSaturation;
                    auroraModColor.v *= Settings.options.auroraIntensity;
                }

                float auroraLevel = Mathf.Clamp01(GameManager.GetAuroraManager().m_NormalizedActive / GameManager.GetAuroraManager().m_FullyActiveValue);

                baseSun = Color.Lerp(origSun, auroraModColor, auroraLevel);
                baseFog = Color.Lerp(origFog, auroraModColor, auroraLevel);
            }

            float baseInt = 1f;
            float baseRng = 10f;

            //Setup Global values

            ls.intMod = ApplyWeatherIntensityMod() + (GetFlickeringMod() * 1f);
            ls.rngMod = ApplyWeatherRangeMod();

            ls.shadowStr     = GetShadowStrength();
            ls.lightshaftStr = GetLightshaftStrength();
            ls.sunStr        = (GetLightshaftStrength() + (GetFlickeringMod() * 0.4f)) * GetSunStrength();

            //Lightshaft
            ColorHSV sColor = baseSun;

            sColor.v           = 0.8f;
            ls.lightshaftColor = ApplyWeatherMod(sColor);

            //Ambience
            Color bColor = ApplyWeatherMod(baseSun);

            ColorHSV dColor = bColor;

            dColor.s *= 0.5f;
            //Flicker doesn't affect ambience
            //dColor.v = 0.4f + (GetFlickeringMod() * 0.1f);
            dColor.v = 0.4f;

            ColorHSV nColor = dColor;

            nColor.v = 0.01f;

            ls.ambientDayColor   = dColor;
            ls.ambientNightColor = nColor;

            //Windows
            ColorHSV wColor = bColor;

            wColor.s *= Mathf.Min(ApplyWeatherSaturationMod() - 0.2f, 0.4f);
            wColor.v *= (ls.intMod + 0.5f) + GetFlickeringMod();

            ls.windowColor = wColor;

            ls.windowStrMod = ls.intMod;

            //Setup Orientations
            foreach (string dir in cardinal)
            {
                Color lColor = baseFog;

                if (prd != null)
                {
                    float sunMix = Mathf.Lerp(prd.orientations[dir].sun[0], prd.orientations[dir].sun[1], TimeWeather.currentPeriodPct);
                    lColor = Color.Lerp(baseFog, baseSun, sunMix);

                    //Apply hue mod
                    if (prd.orientations[dir].hue != null)
                    {
                        float    hueMix    = Mathf.Lerp(prd.orientations[dir].hue[0], prd.orientations[dir].hue[1], TimeWeather.currentPeriodPct);
                        ColorHSV lColorHSV = new ColorHSV(lColor);

                        lColorHSV.h += hueMix;

                        lColor = lColorHSV;
                    }

                    //Apply weather mods
                    lColor = ApplyWeatherMod(lColor);

                    //Apply Intensity & Range
                    baseInt = Mathf.Lerp(prd.intensity[0], prd.intensity[1], TimeWeather.currentPeriodPct);
                    baseRng = Mathf.Lerp(prd.range[0], prd.range[1], TimeWeather.currentPeriodPct);
                }

                LightOrientation lo = new LightOrientation
                {
                    color     = (Color)lColor,
                    intensity = baseInt,
                    range     = baseRng
                };

                ls.orientations.Add(dir, lo);
            }

            LightOrientation defaultOrientation = new LightOrientation
            {
                color     = baseFog,
                intensity = baseInt,
                range     = baseRng
            };

            ls.orientations.Add("default", defaultOrientation);

            return(ls);
        }