예제 #1
0
        public override string GetReport()
        {
            if (base.Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.Eclipse))
            {
                return("WatchingEclipse".Translate());
            }
            if (base.Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.Aurora))
            {
                return("WatchingAurora".Translate());
            }
            float num = GenCelestial.CurCelestialSunGlow(base.Map);

            if (num < 0.1f)
            {
                return("Stargazing".Translate());
            }
            if (num >= 0.65f)
            {
                return("CloudWatching".Translate());
            }
            if (GenLocalDate.DayPercent(this.pawn) < 0.5f)
            {
                return("WatchingSunrise".Translate());
            }
            return("WatchingSunset".Translate());
        }
예제 #2
0
        public static GenCelestial.LightInfo GetLightSourceInfo(Map map, GenCelestial.LightType type)
        {
            float num = GenLocalDate.DayPercent(map);
            bool  flag;
            float intensity;

            if (type == GenCelestial.LightType.Shadow)
            {
                flag      = GenCelestial.IsDaytime(GenCelestial.CurCelestialSunGlow(map));
                intensity = GenCelestial.CurShadowStrength(map);
            }
            else if (type == GenCelestial.LightType.LightingSun)
            {
                flag      = true;
                intensity = Mathf.Clamp01((GenCelestial.CurCelestialSunGlow(map) - 0.6f + 0.2f) / 0.15f);
            }
            else if (type == GenCelestial.LightType.LightingMoon)
            {
                flag      = false;
                intensity = Mathf.Clamp01(-(GenCelestial.CurCelestialSunGlow(map) - 0.6f - 0.2f) / 0.15f);
            }
            else
            {
                Log.ErrorOnce("Invalid light type requested", 64275614, false);
                flag      = true;
                intensity = 0f;
            }
            float t;
            float num2;
            float num3;

            if (flag)
            {
                t    = num;
                num2 = -1.5f;
                num3 = 15f;
            }
            else
            {
                if (num > 0.5f)
                {
                    t = Mathf.InverseLerp(0.5f, 1f, num) * 0.5f;
                }
                else
                {
                    t = 0.5f + Mathf.InverseLerp(0f, 0.5f, num) * 0.5f;
                }
                num2 = -0.9f;
                num3 = 15f;
            }
            float num4 = Mathf.LerpUnclamped(-num3, num3, t);
            float y    = num2 - 2.5f * (num4 * num4 / 100f);

            return(new GenCelestial.LightInfo
            {
                vector = new Vector2(num4, y),
                intensity = intensity
            });
        }
예제 #3
0
        public override SkyTarget?SkyTarget(Map map)
        {
            Color       currentColor = this.CurrentColor;
            SkyColorSet colorSet     = new SkyColorSet(Color.Lerp(Color.white, currentColor, 0.075f) * this.Brightness(map), new Color(0.92f, 0.92f, 0.92f), Color.Lerp(Color.white, currentColor, 0.025f) * this.Brightness(map), 1f);
            float       glow         = Mathf.Max(GenCelestial.CurCelestialSunGlow(map), 0.25f);

            return(new SkyTarget?(new SkyTarget(glow, colorSet, 1f, 1f)));
        }
예제 #4
0
        public override SkyTarget?SkyTarget()
        {
            Color currentColor = this.CurrentColor;

            this.AuroraSkyColors.sky     = Color.Lerp(Color.white, currentColor, 0.075f) * this.Brightness;
            this.AuroraSkyColors.overlay = Color.Lerp(Color.white, currentColor, 0.025f) * this.Brightness;
            float glow = Mathf.Max(GenCelestial.CurCelestialSunGlow(base.Map), 0.25f);

            return(new SkyTarget?(new SkyTarget(glow, this.AuroraSkyColors, 1f, 1f)));
        }
        protected override bool CanFireNowSub(IIncidentTarget target)
        {
            if (!base.CanFireNowSub(target))
            {
                return(false);
            }
            Map map = (Map)target;

            return(GenCelestial.CurCelestialSunGlow(map) <= 0.5f && GenCelestial.CelestialSunGlow(map, Find.TickManager.TicksAbs + 5000) <= 0.5f);
        }
예제 #6
0
        public static LightInfo GetLightSourceInfo(Map map, LightType type)
        {
            float num = GenLocalDate.DayPercent(map);
            bool  flag;
            float intensity;

            switch (type)
            {
            case LightType.Shadow:
                flag      = GenCelestial.IsDaytime(GenCelestial.CurCelestialSunGlow(map));
                intensity = GenCelestial.CurShadowStrength(map);
                break;

            case LightType.LightingSun:
                flag      = true;
                intensity = Mathf.Clamp01((float)((GenCelestial.CurCelestialSunGlow(map) - 0.60000002384185791 + 0.20000000298023224) / 0.15000000596046448));
                break;

            case LightType.LightingMoon:
                flag      = false;
                intensity = Mathf.Clamp01((float)((0.0 - (GenCelestial.CurCelestialSunGlow(map) - 0.60000002384185791 - 0.20000000298023224)) / 0.15000000596046448));
                break;

            default:
                Log.ErrorOnce("Invalid light type requested", 64275614);
                flag      = true;
                intensity = 0f;
                break;
            }
            float t;
            float num2;
            float num3;

            if (flag)
            {
                t    = num;
                num2 = -1.5f;
                num3 = 15f;
            }
            else
            {
                t    = (float)((!(num > 0.5)) ? (0.5 + Mathf.InverseLerp(0f, 0.5f, num) * 0.5) : (Mathf.InverseLerp(0.5f, 1f, num) * 0.5));
                num2 = -0.9f;
                num3 = 15f;
            }
            float     num4   = Mathf.LerpUnclamped((float)(0.0 - num3), num3, t);
            float     y      = (float)(num2 - 2.5 * (num4 * num4 / 100.0));
            LightInfo result = default(LightInfo);

            result.vector    = new Vector2(num4, y);
            result.intensity = intensity;
            return(result);
        }
예제 #7
0
 private bool AuroraWillEndSoon(Map map)
 {
     if (GenCelestial.CurCelestialSunGlow(map) > 0.5f)
     {
         return(true);
     }
     if (GenCelestial.CelestialSunGlow(map, Find.TickManager.TicksAbs + 5000) > 0.5f)
     {
         return(true);
     }
     return(false);
 }
예제 #8
0
 public override void GameConditionTick()
 {
     this.curColorTransition += 1f / (float)this.TransitionDurationTicks;
     if (this.curColorTransition >= 1f)
     {
         this.prevColorIndex     = this.curColorIndex;
         this.curColorIndex      = this.GetNewColorIndex();
         this.curColorTransition = 0f;
     }
     if (!base.Permanent && base.TicksLeft > 200 && GenCelestial.CurCelestialSunGlow(base.Map) > 0.5f)
     {
         base.TicksLeft = 200;
     }
 }
 private float Brightness(Map map)
 {
     return(Mathf.Max(0.73f, GenCelestial.CurCelestialSunGlow(map)));
 }
        public override SkyTarget?SkyTarget(Map map)
        {
            Color currentColor = CurrentColor;

            return(new SkyTarget(colorSet: new SkyColorSet(Color.Lerp(Color.white, currentColor, 0.075f) * Brightness(map), new Color(0.92f, 0.92f, 0.92f), Color.Lerp(Color.white, currentColor, 0.025f) * Brightness(map), 1f), glow: Mathf.Max(GenCelestial.CurCelestialSunGlow(map), 0.25f), lightsourceShineSize: 1f, lightsourceShineIntensity: 1f));
        }
예제 #11
0
 public static float CurShadowStrength(Map map)
 {
     return(Mathf.Clamp01((float)(Mathf.Abs((float)(GenCelestial.CurCelestialSunGlow(map) - 0.60000002384185791)) / 0.15000000596046448)));
 }
 private bool AuroraWillEndSoon(Map map)
 {
     return(GenCelestial.CurCelestialSunGlow(map) > 0.5f || GenCelestial.CelestialSunGlow(map, Find.TickManager.TicksAbs + 5000) > 0.5f);
 }
예제 #13
0
 public static float CurShadowStrength(Map map)
 {
     return(Mathf.Clamp01(Mathf.Abs(GenCelestial.CurCelestialSunGlow(map) - 0.6f) / 0.15f));
 }