public SkyTarget CurSkyTarget(Map map) { float num = GenCelestial.CurCelestialSunGlow(map); int num2 = 0; int num3 = 0; for (int i = 0; i < skyTargets.Length; i++) { num3 = i; if (num + 0.001f < skyTargets[i].celGlowThreshold) { break; } num2 = i; } SkyThreshold skyThreshold = skyTargets[num2]; SkyThreshold skyThreshold2 = skyTargets[num3]; float num4 = skyThreshold2.celGlowThreshold - skyThreshold.celGlowThreshold; float t = (num4 != 0f) ? ((num - skyThreshold.celGlowThreshold) / num4) : 1f; SkyTarget result = default(SkyTarget); result.glow = num; result.colors = SkyColorSet.Lerp(skyThreshold.colors, skyThreshold2.colors, t); if (GenCelestial.IsDaytime(num)) { result.lightsourceShineIntensity = 1f; result.lightsourceShineSize = 1f; } else { result.lightsourceShineIntensity = 0.7f; result.lightsourceShineSize = 0.5f; } return(result); }
public static SkyTarget LerpDarken(SkyTarget A, SkyTarget B, float t) { SkyTarget result = default(SkyTarget); result.colors = SkyColorSet.Lerp(A.colors, B.colors, t); result.glow = Mathf.Lerp(A.glow, Mathf.Min(A.glow, B.glow), t); result.lightsourceShineSize = Mathf.Lerp(A.lightsourceShineSize, Mathf.Min(A.lightsourceShineSize, B.lightsourceShineSize), t); result.lightsourceShineIntensity = Mathf.Lerp(A.lightsourceShineIntensity, Mathf.Min(A.lightsourceShineIntensity, B.lightsourceShineIntensity), t); return(result); }
public static SkyTarget LerpDarken(SkyTarget A, SkyTarget B, float t) { return(new SkyTarget { colors = SkyColorSet.Lerp(A.colors, B.colors, t), glow = Mathf.Lerp(A.glow, Mathf.Min(A.glow, B.glow), t), lightsourceShineSize = Mathf.Lerp(A.lightsourceShineSize, Mathf.Min(A.lightsourceShineSize, B.lightsourceShineSize), t), lightsourceShineIntensity = Mathf.Lerp(A.lightsourceShineIntensity, Mathf.Min(A.lightsourceShineIntensity, B.lightsourceShineIntensity), t) }); }
public SkyTarget CurSkyTarget(Map map) { float num = GenCelestial.CurCelestialSunGlow(map); int num2 = 0; int num3 = 0; int num4 = 0; while (num4 < this.skyTargets.Length) { num3 = num4; if (!(num + 0.0010000000474974513 < this.skyTargets[num4].celGlowThreshold)) { num2 = num4; num4++; continue; } break; } SkyThreshold skyThreshold = this.skyTargets[num2]; SkyThreshold skyThreshold2 = this.skyTargets[num3]; float num5 = skyThreshold2.celGlowThreshold - skyThreshold.celGlowThreshold; float t = (float)((num5 != 0.0) ? ((num - skyThreshold.celGlowThreshold) / num5) : 1.0); SkyTarget result = default(SkyTarget); result.glow = num; result.colors = SkyColorSet.Lerp(skyThreshold.colors, skyThreshold2.colors, t); if (GenCelestial.IsDaytime(num)) { result.lightsourceShineIntensity = 1f; result.lightsourceShineSize = 1f; } else { result.lightsourceShineIntensity = 0.7f; result.lightsourceShineSize = 0.5f; } return(result); }