internal AmbPeriod GetPeriodSet(string periodName = "")
        {
            if (!ready)
            {
                return(null);
            }

            AmbPeriod period = null;

            if (periodName == "")
            {
                periodName = TimeWeather.currentPeriod;
            }

            if (data.periods.ContainsKey(periodName))
            {
                period = data.periods[periodName];
            }
            else if (data.periods.ContainsKey("default"))
            {
                period = data.periods["default"];
            }

            return(period);
        }
        internal float GetSunStrength()
        {
            AmbPeriod prd    = GetPeriodSet();
            float     prdMod = 1;

            if (prd != null)
            {
                prdMod = Mathf.Lerp(prd.sun_strength[0], prd.sun_strength[1], TimeWeather.currentPeriodPct);
            }

            return(prdMod);
        }
        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);
        }