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); }
private static bool IsOrcaActive() { TODBlendState todBlendState = GameManager.GetTimeOfDayComponent().GetTODBlendState(); if (todBlendState == TODBlendState.NightEndToDawn || todBlendState == TODBlendState.NightStartToNightEnd) { return(false); } if (GameManager.GetWeatherComponent().IsBlizzard()) { return(false); } return(true); }
internal static float GetIntensityNightMod() { float baseMod = 1f; float nightMod = 1f; switch (Settings.options.nightBrightness) { case 0: nightMod = 0f; break; case 1: nightMod = 1f; break; case 2: nightMod = 1.5f; break; case 3: nightMod = 1.8f; break; } TODBlendState bState = GameManager.GetUniStorm().GetTODBlendState(); if (bState == TODBlendState.DuskToNightStart) { baseMod = Mathf.Lerp(1f, nightMod, GameManager.GetUniStorm().GetTODBlendPercent(bState)); } else if (bState == TODBlendState.NightEndToDawn) { baseMod = Mathf.Lerp(nightMod, 1f, GameManager.GetUniStorm().GetTODBlendPercent(bState)); } return(baseMod); }
private static bool Prefix(ref string __result)//, float ___m_TempLow, float ___m_TempHigh) { TODBlendState todblendState = GameManager.GetUniStorm().GetTODBlendState(); if ((Time.frameCount % 1600) == 0) { Debug.Log(" "); } float num = GameManager.GetUniStorm().GetTODBlendPercent(todblendState) * 100f; string text = uConsoleLog.GetLine(uConsoleLog.GetNumLines() - 3); text += "\n" + uConsoleLog.GetLine(uConsoleLog.GetNumLines() - 2); text += "\n" + uConsoleLog.GetLine(uConsoleLog.GetNumLines() - 1); string nameForScene = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; string nameForScene2 = Utils.GetHardcodedRegionForLocation(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name); text += "\n\n" + nameForScene + " (" + nameForScene2 + ")"; text += "\n" + Enum.GetName(typeof(TODBlendState), todblendState) + "(" + num.ToString("F2") + "%)"; text += GameManager.GetWeatherTransitionComponent().GetDebugString(); Wind windComponent = GameManager.GetWindComponent(); text += "\nWind Actual Speed: " + windComponent.GetSpeedMPH().ToString("F1"); /* string text2 = text; * text = string.Concat(new string[] * { * text2, * "\nWind Speed Base: ", * windComponent.GetSpeedMPH_Base().ToString("F1"), * " MPH. Target Wind Speed: ", * windComponent.GetTargetSpeedMPH().ToString("F1"), * " MPH. Angle Base: ", * windComponent.GetWindAngle_Base().ToString("F1") * }); * text2 = text; * text = string.Concat(new string[] * { * text2, * "\nWind Actual Speed: ", * windComponent.GetSpeedMPH().ToString("F1"), * " MPH. Actual Angle: ", * windComponent.GetWindAngle().ToString("F1") * }); * text = text + "\nPlayer Speed: " + GameManager.GetVpFPSPlayer().Controller.Velocity.magnitude; * text = text + "\nPlayer Wind Angle: " + windComponent.GetWindAngleRelativeToPlayer().ToString("F1"); * text = text + "\nWwise WindIntensity: " + windComponent.m_LastWindIntensityBlendSentToWise.ToString("F0"); * text = text + "\nWwise GustStrength: " + windComponent.m_LastWindGustStrengthSentToWise.ToString("F0"); */ text = text + "\nLocal snow depth: " + string.Format("{0:0.09}", GameManager.GetSnowPatchManager().GetLocalSnowDepth()); //text = text + "\nAurora alpha: " + GameManager.GetAuroraManager().GetNormalizedAlpha(); if (GameManager.GetAuroraManager().IsFullyActive()) { text = text + "\nAurora fully active. electrolyzer: " + GameManager.GetAuroraManager().GetAuroraElectrolyzerFadeRatio(); } if (WeatherTransition.m_SuppressBlizzards) { text += "\nBLIZZARDS ARE SUPPRESSED"; } /*if (FlyOver.GetCurrentFormation()) * { * float y = FlyOver.GetCurrentFormation().transform.position.y; * float num2 = Vector3.Magnitude(FlyOver.GetCurrentFormation().transform.position - GameManager.GetPlayerTransform().position); * text2 = text; * text = string.Concat(new string[] * { * text2, * "\nFlyOver: height ", * y.ToString("F0"), * " distance ", * num2.ToString("F0"), * " angle ", * FlyOver.m_DebugAngle.ToString("F2") * }); * } */ float tempRamp = Solstice_RV.TemperatureOffset; Weather theweather = GameManager.GetWeatherComponent(); float indoor = 0; float outs = Solstice_RV.outsideTemp; float gnd = Solstice_RV.groundTemp; float fire = GameManager.GetHeatSourceManagerComponent().GetTemperatureIncrease(); float height = GameManager.GetPlayerTransform().position.y + Solstice_RV.GetBaseHeight(UnityEngine.SceneManagement.SceneManager.GetActiveScene().name); float alt = height / -100f; float curTemp = theweather.GetCurrentTemperature(); float inside = -1000.0f; float indoor_tempfinal = -1000; float final_outside = outs + alt + tempRamp; string instr = ""; float missing = curTemp - (final_outside + indoor + Solstice_RV.playerSunBuff() + fire); if (theweather.IsIndoorEnvironment() && !(GameManager.GetPlayerManagerComponent().m_IndoorSpaceTrigger&& GameManager.GetPlayerManagerComponent().m_IndoorSpaceTrigger.m_UseOutdoorTemperature)) { inside = theweather.m_IndoorTemperatureCelsius; final_outside += Solstice_RV.lastoutsideAltitudeAdjustment; indoor_tempfinal = (final_outside + inside + gnd) / 3; instr = " Ins :" + string.Format("{0:0.0}", inside) + " Fin:" + string.Format("{0:0.0}", indoor_tempfinal); missing = curTemp - (indoor_tempfinal + fire); } else if (GameManager.GetPlayerManagerComponent().m_IndoorSpaceTrigger) { indoor = GameManager.GetPlayerManagerComponent().m_IndoorSpaceTrigger.m_TemperatureDeltaCelsius; indoor_tempfinal = ((final_outside + alt) + gnd * 2) / 3; instr = " Fin:" + string.Format("{0:0.0}", indoor_tempfinal); missing = curTemp - (indoor_tempfinal + fire); } //float blizdrop = (float)AccessTools.Field(typeof(Weather), "m_CurrentBlizzardDegreesDrop").GetValue(theweather); text += "\nGnd:" + string.Format("{0:0.0}", gnd); text += " Air:" + string.Format("{0:0.0}", outs); text += " Alt:" + string.Format("{0:0.0}", alt); text += " Ramp:" + string.Format("{0:0.0}", tempRamp); text += " Outs:" + string.Format("{0:0.0}", final_outside); text += instr; text += "\nMss:" + string.Format("{0:0.00}", Solstice_RV.airmassChangePerMin); text += " SunB:" + string.Format("{0:0.0}", Solstice_RV.playerSunBuff()); text += " Fire" + string.Format("{0:0.0}", fire); float TempNoFire = GameManager.GetWeatherComponent().GetCurrentTemperatureWithoutHeatSources(); text += "\nTNoF: " + string.Format("{0:0.0}", TempNoFire); text += " Miss:" + string.Format("{0:0.0}", (curTemp - (TempNoFire + fire))); text += "\nTemp:" + string.Format("{0:0.0}", curTemp); text += " Miss:" + string.Format("{0:0.0}", missing); text += "\n"; __result = text; return(false); }
internal static bool Prefix(ActiveEnvironment __instance, WeatherStateConfig wsA, WeatherStateConfig wsB, float weatherBlendFrac, TODBlendState todBlendState, float todBlendFrac, float todBlendBiased, bool isIndoors) { // if ((Time.frameCount % 50) == 0) { ColorGradingSettings settings1A = null; ColorGradingSettings settings1B = null; ColorGradingSettings settings2A = null; ColorGradingSettings settings2B = null; Traverse traverseA = Traverse.Create(__instance).Field("m_WorkA"); TODStateConfig m_WorkA = traverseA.GetValue <TODStateConfig>(); Traverse traverseB = Traverse.Create(__instance).Field("m_WorkB"); TODStateConfig m_WorkB = traverseB.GetValue <TODStateConfig>(); TODStateConfig[] wsA_TodStates = { wsA.m_NightColors, wsA.m_DawnColors, wsA.m_MorningColors, wsA.m_MiddayColors, wsA.m_AfternoonColors, wsA.m_DuskColors, wsA.m_NightColors, wsA.m_NightColors }; TODStateConfig[] wsB_TodStates = { wsB.m_NightColors, wsB.m_DawnColors, wsB.m_MorningColors, wsB.m_MiddayColors, wsB.m_AfternoonColors, wsB.m_DuskColors, wsB.m_NightColors, wsA.m_NightColors }; bool flagtoAdd = false; int[] nightstates = { 1, 0, 0, 0, 0, 2, 3 }; float[] keyangles = { Solstice_RV.dawndusk_angle, Solstice_RV.riseset_angle, Solstice_RV.mornaft_angle, Solstice_RV.getSunAngleAtUnitime(Mathf.Floor(Solstice_RV.unitime()) + 0.5f), Solstice_RV.mornaft_angle, Solstice_RV.riseset_angle, Solstice_RV.dawndusk_angle, Solstice_RV.getSunAngleAtUnitime(Mathf.Floor(Solstice_RV.unitime())) }; if (GameManager.GetUniStorm().m_NormalizedTime > 1f) { GameManager.GetUniStorm().SetNormalizedTime(GameManager.GetUniStorm().m_NormalizedTime - 1f); flagtoAdd = true; } todBlendState = GameManager.GetUniStorm().GetTODBlendState(); // Debug.Log(todBlendState); int itod = (int)todBlendState; string debugtext; float zenith = Solstice_RV.getSunAngleAtUnitime(Mathf.Floor(Solstice_RV.unitime()) + 0.5f); float nadir = Solstice_RV.getSunAngleAtUnitime(Mathf.Floor(Solstice_RV.unitime()) + 0.0f); float throughpcntzen; float throughpcntnad; TODStateConfig wsAStartblend; TODStateConfig wsAEndblend; TODStateConfig wsBStartblend; TODStateConfig wsBEndblend; TODStateConfig wsAZenblend; TODStateConfig wsANadblend; TODStateConfig wsBZenblend; TODStateConfig wsBNadblend; wsAStartblend = wsA_TodStates[itod]; wsAEndblend = wsA_TodStates[itod + 1]; wsBStartblend = wsB_TodStates[itod]; wsBEndblend = wsB_TodStates[itod + 1]; String namestartblend = Enum.GetNames(typeof(TODBlendState))[(int)todBlendState]; String nameendblend = Enum.GetNames(typeof(TODBlendState))[((int)todBlendState + 1) % 6]; float st_ang = keyangles[itod]; float en_ang = keyangles[itod + 1]; throughpcntzen = (zenith - st_ang) / (en_ang - st_ang); debugtext = Solstice_RV.gggtime(Solstice_RV.unitime()) + " " + Enum.GetNames(typeof(TODBlendState))[(int)todBlendState]; // do we need a new zen state if (throughpcntzen >= 0 && throughpcntzen <= 1) { if (itod == (int)TODBlendState.MorningToMidday)// need to correct against game zenith of 45 { throughpcntzen = Mathf.Clamp((zenith - st_ang) / (45f - st_ang), 0, 1); } if (itod == (int)TODBlendState.MiddayToAfternoon)// need to correct against game zenith of 45 { throughpcntzen = Mathf.Clamp((zenith - 45f) / (en_ang - 45f), 0, 1); } //debugtext += " mc:" + throughpcntzen; wsAZenblend = Solstice_RV.createNewMidPoint(wsA_TodStates[itod], wsA_TodStates[itod + 1], wsA_TodStates[6 - itod], wsA_TodStates[((5 - itod) % 8 + 8) % 8], throughpcntzen); wsBZenblend = Solstice_RV.createNewMidPoint(wsB_TodStates[itod], wsB_TodStates[itod + 1], wsB_TodStates[6 - itod], wsB_TodStates[((5 - itod) % 8 + 8) % 8], throughpcntzen); if (itod < 3) { en_ang = zenith; nameendblend = "Zen"; wsAEndblend = wsAZenblend; wsBEndblend = wsBZenblend; } else { st_ang = zenith; namestartblend = "Zen"; wsAStartblend = wsAZenblend; wsBStartblend = wsBZenblend; } } throughpcntnad = (nadir - st_ang) / (en_ang - st_ang); if (throughpcntnad >= 0 && throughpcntnad <= 1) { debugtext += " mc:" + throughpcntnad + "[" + itod + "][" + (itod + 1) + "][" + (6 - itod) + "][" + ((5 - itod) % 8 + 8) % 8 + "]"; wsANadblend = Solstice_RV.createNewMidPoint(wsA_TodStates[itod], wsA_TodStates[itod + 1], wsA_TodStates[6 - itod], wsA_TodStates[((5 - itod) % 8 + 8) % 8], throughpcntnad); wsBNadblend = Solstice_RV.createNewMidPoint(wsB_TodStates[itod], wsB_TodStates[itod + 1], wsB_TodStates[6 - itod], wsB_TodStates[((5 - itod) % 8 + 8) % 8], throughpcntnad); if (itod > 3) { en_ang = nadir; nameendblend = "Nad"; wsAEndblend = wsANadblend; wsBEndblend = wsBNadblend; } else { st_ang = nadir; namestartblend = "Nad"; wsAStartblend = wsANadblend; wsBStartblend = wsBNadblend; } } float newtodBlendFrac = (Solstice_RV.getSunAngleAtUnitime(Solstice_RV.unitime()) - st_ang) / (en_ang - st_ang); debugtext += "(" + namestartblend + ":" + nameendblend + ")"; debugtext += " s:" + st_ang + " e:" + en_ang + " c:" + string.Format("{0:0.00}", Solstice_RV.getSunAngleAtUnitime(Solstice_RV.unitime())) + " =:" + string.Format("{0:0.00}", newtodBlendFrac); m_WorkA.SetBlended(wsAStartblend, wsAEndblend, newtodBlendFrac, newtodBlendFrac, nightstates[itod]); m_WorkB.SetBlended(wsBStartblend, wsBEndblend, newtodBlendFrac, newtodBlendFrac, nightstates[itod]); settings1A = wsA_TodStates[(int)todBlendState].m_ColorGradingSettings; settings1B = wsA_TodStates[((int)todBlendState + 1) % 7].m_ColorGradingSettings; settings2A = wsB_TodStates[(int)todBlendState].m_ColorGradingSettings; settings2B = wsB_TodStates[((int)todBlendState + 1) % 7].m_ColorGradingSettings; __instance.m_TodState.SetBlended(m_WorkA, m_WorkB, weatherBlendFrac, weatherBlendFrac, 0); //if ((Time.frameCount % 1600) == 0) Debug.Log(debugtext); if (isIndoors) { __instance.m_TodState.SetIndoors(); } else { UnityEngine.Rendering.PostProcessing.ColorGrading colorGrading = GameManager.GetCameraEffects().ColorGrading(); if (colorGrading != null) { //if ((Time.frameCount % 50) == 0) Debug.Log("[A"+ (int)todBlendState + "][A"+ ((int)todBlendState + 1) % 7 + "[B" + (int)todBlendState + "][B" + ((int)todBlendState + 1) % 7 + "],"+ newtodBlendFrac + ","+ weatherBlendFrac); colorGrading.UpdateLutForTimeOfDay(settings1A, settings1B, settings2A, settings2B, newtodBlendFrac, newtodBlendFrac, weatherBlendFrac); //colorGrading.UpdateLutForTimeOfDay(wsA.m_DawnColors.m_ColorGradingSettings, wsA.m_MorningColors.m_ColorGradingSettings, wsB.m_DawnColors.m_ColorGradingSettings, wsB.m_MorningColors.m_ColorGradingSettings, 0.5f,0.5f, 0.5f); } } __instance.m_GrassTintScalar = Mathf.Lerp(wsA.m_GrassTintScalar, wsB.m_GrassTintScalar, weatherBlendFrac); if (flagtoAdd) { GameManager.GetUniStorm().SetNormalizedTime(GameManager.GetUniStorm().m_NormalizedTime + 1f); } return(false); } }