コード例 #1
0
        public override string GetReport()
        {
            if (base.Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.Eclipse))
            {
                return("Sunbathing");
            }
            if (base.Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.Aurora))
            {
                return("Sunbathing");
            }
            float num = GenCelestial.CurCelestialSunGlow(base.Map);

            if (num < 0.1f)
            {
                return("Sunbathing");
            }
            if (num >= 0.65f)
            {
                return("Sunbathing");
            }
            if (GenLocalDate.DayPercent(this.pawn) < 0.5f)
            {
                return("Sunbathing");
            }
            return("Sunbathing");
        }
コード例 #2
0
        public void ComputeShipShadowExactPosition()
        {
            float f = !this.def.skyfaller.zPositionCurve.EnumerableNullOrEmpty() ? this.def.skyfaller.zPositionCurve.Evaluate(this.TimeInAnimation) : this.TimeInAnimation;

            GenCelestial.LightInfo lightSourceInfo = GenCelestial.GetLightSourceInfo(base.Map, GenCelestial.LightType.Shadow);
            this.shadowExactPosition = this.exactPosition + (Mathf.Max(0.25f, f) * new Vector3(lightSourceInfo.vector.x, -0.1f, lightSourceInfo.vector.y));
        }
コード例 #3
0
        //Sunrise is very dangerous to be out.
        public static bool IsSunRisingOrDaylight(Map m)
        {
            //If it's daylight, it's not safe.
            var curSunlight = GenCelestial.CurCelestialSunGlow(m);

            if (GenCelestial.IsDaytime(curSunlight))
            {
                return(true);
            }

            if (curSunlight > 0.01f)
            {
                var lastSunlight = 0f;
                if (!lastSunlightChecks.ContainsKey(m))
                {
                    lastSunlightChecks.Add(m, curSunlight);
                    lastSunlight = curSunlight;
                }
                else
                {
                    lastSunlight = lastSunlightChecks[m];
                }
                return(curSunlight > lastSunlight);
            }
            return(false);
        }
コード例 #4
0
ファイル: WeatherWorker.cs プロジェクト: KraigXu/GameProject
        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);
        }
コード例 #5
0
        public void SkyManagerUpdate()
        {
            SkyTarget curSky = this.CurrentSkyTarget();

            this.curSkyGlowInt = curSky.glow;
            if (this.map == Find.VisibleMap)
            {
                MatBases.LightOverlay.color = curSky.colors.sky;
                Find.CameraColor.saturation = curSky.colors.saturation;
                Color color = curSky.colors.sky;
                color.a = 1f;
                color  *= SkyManager.FogOfWarBaseColor;
                MatBases.FogOfWar.color = color;
                Color   color2 = curSky.colors.shadow;
                Vector3?overridenShadowVector = this.GetOverridenShadowVector();
                if (overridenShadowVector.HasValue)
                {
                    this.SetSunShadowVector(overridenShadowVector.Value);
                }
                else
                {
                    GenCelestial.LightInfo lightSourceInfo = GenCelestial.GetLightSourceInfo(this.map, GenCelestial.LightType.Shadow);
                    this.SetSunShadowVector(lightSourceInfo.vector);
                    color2 = Color.Lerp(Color.white, color2, GenCelestial.CurShadowStrength(this.map));
                }
                GenCelestial.LightInfo lightSourceInfo2 = GenCelestial.GetLightSourceInfo(this.map, GenCelestial.LightType.LightingSun);
                GenCelestial.LightInfo lightSourceInfo3 = GenCelestial.GetLightSourceInfo(this.map, GenCelestial.LightType.LightingMoon);
                Shader.SetGlobalVector(ShaderPropertyIDs.WaterCastVectSun, new Vector4(lightSourceInfo2.vector.x, 0f, lightSourceInfo2.vector.y, lightSourceInfo2.intensity));
                Shader.SetGlobalVector(ShaderPropertyIDs.WaterCastVectMoon, new Vector4(lightSourceInfo3.vector.x, 0f, lightSourceInfo3.vector.y, lightSourceInfo3.intensity));
                Shader.SetGlobalFloat("_LightsourceShineSizeReduction", (float)(20.0 * (1.0 / curSky.lightsourceShineSize)));
                Shader.SetGlobalFloat("_LightsourceShineIntensity", curSky.lightsourceShineIntensity);
                MatBases.SunShadow.color = color2;
                this.UpdateOverlays(curSky);
            }
        }
コード例 #6
0
 public override IEnumerable Regenerate()
 {
     foreach (object item in base.Regenerate())
     {
         yield return(item);
     }
     Rand.PushState();
     Rand.Seed = Find.World.info.Seed;
     for (int i = 0; i < 1500; i++)
     {
         Vector3      unitVector = Rand.UnitVector3;
         Vector3      pos        = unitVector * 10f;
         LayerSubMesh subMesh    = GetSubMesh(WorldMaterials.Stars);
         float        num        = StarsDrawSize.RandomInRange;
         Vector3      rhs        = (UseStaticRotation ? GenCelestial.CurSunPositionInWorldSpace().normalized : Vector3.forward);
         float        num2       = Vector3.Dot(unitVector, rhs);
         if (num2 > 0.8f)
         {
             num *= GenMath.LerpDouble(0.8f, 1f, 1f, 0.35f, num2);
         }
         WorldRendererUtility.PrintQuadTangentialToPlanet(pos, num, 0f, subMesh, counterClockwise: true, randomizeRotation: true);
     }
     calculatedForStartingTile   = ((Find.GameInitData != null) ? Find.GameInitData.startingTile : (-1));
     calculatedForStaticRotation = UseStaticRotation;
     Rand.PopState();
     FinalizeMesh(MeshParts.All);
 }
コード例 #7
0
    public override string GetReport()
    {
        if (Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.Eclipse))
        {
            return("Brrr.OohEclipse".Translate());
        }

        if (Map.gameConditionManager.ConditionIsActive(GameConditionDefOf.Aurora))
        {
            return("Brrr.OohAurora".Translate());
        }

        var num = GenCelestial.CurCelestialSunGlow(Map);

        if (num < 0.1f)
        {
            return("Brrr.OohStarGazing".Translate());
        }

        if (num >= 0.65f)
        {
            return("Brrr.OohClouds".Translate());
        }

        if (GenLocalDate.DayPercent(pawn) < 0.5f)
        {
            return("Brrr.OohSunrise".Translate());
        }

        return("Brrr.OohSunset".Translate());
    }
コード例 #8
0
ファイル: SkyManager.cs プロジェクト: KraigXu/GameProject
        public void SkyManagerUpdate()
        {
            SkyTarget curSky = CurrentSkyTarget();

            curSkyGlowInt = curSky.glow;
            if (map == Find.CurrentMap)
            {
                MatBases.LightOverlay.color = curSky.colors.sky;
                //Find.CameraColor.saturation = curSky.colors.saturation;
                Color sky = curSky.colors.sky;
                sky.a = 1f;
                sky  *= FogOfWarBaseColor;
                MatBases.FogOfWar.color = sky;
                Color   color = curSky.colors.shadow;
                Vector3?overridenShadowVector = GetOverridenShadowVector();
                if (overridenShadowVector.HasValue)
                {
                    SetSunShadowVector(overridenShadowVector.Value);
                }
                else
                {
                    SetSunShadowVector(GenCelestial.GetLightSourceInfo(map, GenCelestial.LightType.Shadow).vector);
                    color = Color.Lerp(Color.white, color, GenCelestial.CurShadowStrength(map));
                }
                GenCelestial.LightInfo lightSourceInfo  = GenCelestial.GetLightSourceInfo(map, GenCelestial.LightType.LightingSun);
                GenCelestial.LightInfo lightSourceInfo2 = GenCelestial.GetLightSourceInfo(map, GenCelestial.LightType.LightingMoon);
                Shader.SetGlobalVector(ShaderPropertyIDs.WaterCastVectSun, new Vector4(lightSourceInfo.vector.x, 0f, lightSourceInfo.vector.y, lightSourceInfo.intensity));
                Shader.SetGlobalVector(ShaderPropertyIDs.WaterCastVectMoon, new Vector4(lightSourceInfo2.vector.x, 0f, lightSourceInfo2.vector.y, lightSourceInfo2.intensity));
                Shader.SetGlobalFloat("_LightsourceShineSizeReduction", 20f * (1f / curSky.lightsourceShineSize));
                Shader.SetGlobalFloat("_LightsourceShineIntensity", curSky.lightsourceShineIntensity);
                MatBases.SunShadow.color = color;
                UpdateOverlays(curSky);
            }
        }
コード例 #9
0
        public static void UpdateWorldShadersParams()
        {
            Vector3 v     = -GenCelestial.CurSunPositionInWorldSpace();
            float   value = (float)((!Find.PlaySettings.usePlanetDayNightSystem) ? 0.0 : 1.0);

            Shader.SetGlobalVector(ShaderPropertyIDs.PlanetSunLightDirection, v);
            Shader.SetGlobalFloat(ShaderPropertyIDs.PlanetSunLightEnabled, value);
            WorldMaterials.PlanetGlow.SetFloat(ShaderPropertyIDs.PlanetRadius, 100f);
            WorldMaterials.PlanetGlow.SetFloat(ShaderPropertyIDs.GlowRadius, 8f);
        }
コード例 #10
0
ファイル: SkyManager.cs プロジェクト: KraigXu/GameProject
        public string DebugString()
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine("SkyManager: ");
            stringBuilder.AppendLine("CurCelestialSunGlow: " + GenCelestial.CurCelestialSunGlow(Find.CurrentMap));
            stringBuilder.AppendLine("CurSkyGlow: " + CurSkyGlow.ToStringPercent());
            stringBuilder.AppendLine("CurrentSkyTarget: " + CurrentSkyTarget().ToString());
            return(stringBuilder.ToString());
        }
コード例 #11
0
        //=> (GenLocalDate.HourInteger(p) >= 6 && GenLocalDate.HourInteger(p) <= 17) && !Find.World.GameConditionManager.ConditionIsActive(GameConditionDefOf.Eclipse);
        public static bool IsDaylight(Map m)
        {
            float num = GenCelestial.CurCelestialSunGlow(m);

            if (GenCelestial.IsDaytime(num) &&
                IsForcedDarknessConditionInactive(m))
            {
                return(true);
            }
            return(false);
        }
コード例 #12
0
        public static float BackgroundDarkAlphaForText()
        {
            if (Find.VisibleMap == null)
            {
                return(0f);
            }
            float num  = GenCelestial.CurCelestialSunGlow(Find.VisibleMap);
            float num2 = (float)((Find.VisibleMap.Biome != BiomeDefOf.IceSheet) ? Mathf.Clamp01((float)(Find.VisibleMap.snowGrid.TotalDepth / 1000.0)) : 1.0);

            return((float)(num * num2 * 0.40999999642372131));
        }
コード例 #13
0
        public static float BackgroundDarkAlphaForText()
        {
            if (Find.CurrentMap == null)
            {
                return(0f);
            }
            float num  = GenCelestial.CurCelestialSunGlow(Find.CurrentMap);
            float num2 = ((Find.CurrentMap.Biome == BiomeDefOf.IceSheet) ? 1f : Mathf.Clamp01(Find.CurrentMap.snowGrid.TotalDepth / 1000f));

            return(num * num2 * 0.41f);
        }
コード例 #14
0
        public override void ComputeShipShadowExactPosition()
        {
            this.spaceshipShadowExactPosition = this.spaceshipExactPosition;
            float shadowDistanceCoefficient = 2f;

            if (this.ticksToLanding < verticalTrajectoryDurationInTicks)
            {
                // Ascending.
                shadowDistanceCoefficient *= ((float)this.ticksToLanding / verticalTrajectoryDurationInTicks);
            }
            GenCelestial.LightInfo lightInfo = GenCelestial.GetLightSourceInfo(this.Map, GenCelestial.LightType.Shadow);
            this.spaceshipShadowExactPosition += new Vector3(lightInfo.vector.x, -0.1f, lightInfo.vector.y) * shadowDistanceCoefficient;
        }
コード例 #15
0
        /// <summary>
        /// Daylight occurs when glow levels rise above 60%.
        /// I used a stopwatch to determine the average time between
        /// the percentage raises is about 161 ticks.
        /// For instance, if the current glow is 40%, 60% - 40% = 20%.
        ///   Then 20 multiplied by 161, which yields 3220 total ticks until daylight.
        /// </summary>
        /// <param name="map"></param>
        /// <returns></returns>
        public static int DetermineTicksUntilDaylight(Map map)
        {
            int result = Int32.MaxValue;

            if (VampireUtility.IsSunRisingOrDaylight(map))
            {
                int curLightLevel      = (int)(GenCelestial.CurCelestialSunGlow(map) * 100);
                int maxLightLevel      = 60;
                int diffLightLevel     = maxLightLevel - curLightLevel;
                int ticksLeftForTravel = TicksBetweenLightChanges * diffLightLevel;
                result = ticksLeftForTravel;
            }
            return(result);
        }
コード例 #16
0
 public override void GameConditionTick()
 {
     base.GameConditionTick();
     if (GenCelestial.CurCelestialSunGlow(base.SingleMap) > thresholdToEnd)
     {
         End();
     }
     foreach (Pawn pawn in map.mapPawns.AllPawns)
     {
         if (map.glowGrid.PsychGlowAt(pawn.Position) == PsychGlow.Dark)
         {
             DamagePawn(pawn);
         }
     }
 }
コード例 #17
0
        public static float BackgroundDarkAlphaForText()
        {
            float result;

            if (Find.CurrentMap == null)
            {
                result = 0f;
            }
            else
            {
                float num  = GenCelestial.CurCelestialSunGlow(Find.CurrentMap);
                float num2 = (Find.CurrentMap.Biome != BiomeDefOf.IceSheet) ? Mathf.Clamp01(Find.CurrentMap.snowGrid.TotalDepth / 1000f) : 1f;
                result = num * num2 * 0.41f;
            }
            return(result);
        }
コード例 #18
0
ファイル: WorldLayer_Stars.cs プロジェクト: potsh/RimWorld
        public override IEnumerable Regenerate()
        {
            IEnumerator enumerator = base.Regenerate().GetEnumerator();

            try
            {
                if (enumerator.MoveNext())
                {
                    object result = enumerator.Current;
                    yield return(result);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            finally
            {
                IDisposable disposable;
                IDisposable disposable2 = disposable = (enumerator as IDisposable);
                if (disposable != null)
                {
                    disposable2.Dispose();
                }
            }
            Rand.PushState();
            Rand.Seed = Find.World.info.Seed;
            for (int i = 0; i < 1500; i++)
            {
                Vector3      unitVector = Rand.UnitVector3;
                Vector3      pos        = unitVector * 10f;
                LayerSubMesh subMesh    = GetSubMesh(WorldMaterials.Stars);
                float        num        = StarsDrawSize.RandomInRange;
                Vector3      rhs        = (!UseStaticRotation) ? Vector3.forward : GenCelestial.CurSunPositionInWorldSpace().normalized;
                float        num2       = Vector3.Dot(unitVector, rhs);
                if (num2 > 0.8f)
                {
                    num *= GenMath.LerpDouble(0.8f, 1f, 1f, 0.35f, num2);
                }
                WorldRendererUtility.PrintQuadTangentialToPlanet(pos, num, 0f, subMesh, counterClockwise: true, randomizeRotation: true);
            }
            calculatedForStartingTile   = ((Find.GameInitData == null) ? (-1) : Find.GameInitData.startingTile);
            calculatedForStaticRotation = UseStaticRotation;
            Rand.PopState();
            FinalizeMesh(MeshParts.All);
            yield break;
IL_01ee:
            /*Error near IL_01ef: Unexpected return in MoveNext()*/;
        }
コード例 #19
0
        public override void Tick()
        {
            base.Tick();

            if (active)
            {
                if (Find.TickManager.TicksGame % chargeRate == 0)
                {
                    if (!Armor.FullCharge && Armor.Wearer != null)
                    {
                        float num = GenCelestial.CurCelestialSunGlow(Armor.Wearer.Map);
                        if (GenCelestial.IsDaytime(num))
                        {
                            Armor.AddCharge(chargeNum);
                        }
                    }
                }
            }
        }
コード例 #20
0
 private CellRect GetSunShadowsViewRect(CellRect rect)
 {
     GenCelestial.LightInfo lightSourceInfo = GenCelestial.GetLightSourceInfo(this.map, GenCelestial.LightType.Shadow);
     if (lightSourceInfo.vector.x < 0f)
     {
         rect.maxX -= Mathf.FloorToInt(lightSourceInfo.vector.x);
     }
     else
     {
         rect.minX -= Mathf.CeilToInt(lightSourceInfo.vector.x);
     }
     if (lightSourceInfo.vector.y < 0f)
     {
         rect.maxZ -= Mathf.FloorToInt(lightSourceInfo.vector.y);
     }
     else
     {
         rect.minZ -= Mathf.CeilToInt(lightSourceInfo.vector.y);
     }
     return(rect);
 }
コード例 #21
0
        private static ThingDef ResolveSpawner(IncidentParms parms)
        {
            Map iwMap      = (Map)parms.target;
            var abberation = (GenCelestial.IsDaytime(GenCelestial.CelestialSunGlow(iwMap, Find.TickManager.TicksAbs)))
                ? MonsterDefOf.ROM_StarVampireSpawnerAbberation
                : MonsterDefOf.ROM_StarVampireSpawnerNight;

            var chance = Rand.Value;

            if (chance > 0.3)
            {
                return(MonsterDefOf.ROM_StarVampireSpawner);
            }
            else if (chance > 0.05)
            {
                return(abberation);
            }
            else
            {
                return(MonsterDefOf.ROM_StarVampireSpawnerAlbino);
            }
        }
コード例 #22
0
        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);
        }
コード例 #23
0
        public int[] CalcPotentialHoursToFire(Map map, int flareTicks, ref int hourCount)
        {
            int currentTick = Find.TickManager.TicksAbs;

            int numHoursFromNow = (flareTicks / 2500);

            if (numHoursFromNow == 0)
            {
                return(null);
            }

            hourCount += numHoursFromNow;
            var result = new int[numHoursFromNow];

            for (int hoursFromNow = 1; hoursFromNow <= numHoursFromNow; hoursFromNow++)
            {
                if (GenCelestial.CelestialSunGlow(map, currentTick + (2500 * hoursFromNow)) < MaxSunGlowForRaid)
                {
                    result[hoursFromNow - 1] = hoursFromNow;
                }
            }

            return(result);
        }
コード例 #24
0
ファイル: SkyManager.cs プロジェクト: KraigXu/GameProject
 private void SetSunShadowVector(Vector2 vec)
 {
     Shader.SetGlobalVector(ShaderPropertyIDs.MapSunLightDirection, new Vector4(vec.x, 0f, vec.y, GenCelestial.CurShadowStrength(map)));
 }
コード例 #25
0
 // Token: 0x0600012B RID: 299 RVA: 0x0000AA80 File Offset: 0x00008C80
 public override void Draw()
 {
     this.spaceshipMatrix.SetTRS(this.DrawPos + Altitudes.AltIncVect, this.spaceshipExactRotation.ToQuat(), this.spaceshipScale);
     Graphics.DrawMesh(MeshPool.plane10, this.spaceshipMatrix, this.spaceshipTexture, 0);
     this.spaceshipShadowMatrix.SetTRS(this.ShadowDrawPos + Altitudes.AltIncVect, this.spaceshipExactRotation.ToQuat(), this.spaceshipShadowScale);
     Graphics.DrawMesh(MeshPool.plane10, this.spaceshipShadowMatrix, FadedMaterialPool.FadedVersionOf(this.spaceshipShadowTexture, 0.75f * GenCelestial.CurShadowStrength(base.Map)), 0);
 }
コード例 #26
0
 // Token: 0x0600013E RID: 318 RVA: 0x0000B8E0 File Offset: 0x00009AE0
 public override void ComputeShipShadowExactPosition()
 {
     GenCelestial.LightInfo lightSourceInfo = GenCelestial.GetLightSourceInfo(base.Map, GenCelestial.LightType.Shadow);
     this.spaceshipShadowExactPosition = this.spaceshipExactPosition + 2f * new Vector3(lightSourceInfo.vector.x, -0.1f, lightSourceInfo.vector.y);
 }
コード例 #27
0
        /*
         * public void ComputeShipExactPosition()
         * {
         *  Vector3 a = new Vector3(0f, 0f, 1f).RotatedBy(this.exactRotation);
         *  this.exactPosition = this.targetPosition.ToVector3ShiftedWithAltitude(AltitudeLayer.Skyfaller);
         *  bool flag = this.ticksBeforeOverflight > 0;
         *  if (flag)
         *  {
         *      bool flag2 = this.ticksBeforeOverflight > this.airStrikeDef.ticksBeforeOverflightReducedSpeed;
         *      if (flag2)
         *      {
         *          float num = (float)(this.ticksBeforeOverflight - this.airStrikeDef.ticksBeforeOverflightReducedSpeed);
         *          float num2 = num * num * 0.01f;
         *          this.shipToTargetDistance = (num2 + (float)this.ticksBeforeOverflight) * this.airStrikeDef.cellsTravelledPerTick;
         *      }
         *      else
         *      {
         *          this.shipToTargetDistance = (float)this.ticksBeforeOverflight * this.airStrikeDef.cellsTravelledPerTick;
         *      }
         *      this.spaceshipExactPosition -= a * this.shipToTargetDistance;
         *  }
         *  else
         *  {
         *      bool flag3 = this.ticksAfterOverflight > this.airStrikeDef.ticksAfterOverflightReducedSpeed;
         *      if (flag3)
         *      {
         *          float num3 = (float)(this.ticksAfterOverflight - this.airStrikeDef.ticksAfterOverflightReducedSpeed);
         *          float num4 = num3 * num3 * 0.01f;
         *          this.shipToTargetDistance = (num4 + (float)this.ticksAfterOverflight) * this.airStrikeDef.cellsTravelledPerTick;
         *      }
         *      else
         *      {
         *          this.shipToTargetDistance = (float)this.ticksAfterOverflight * this.airStrikeDef.cellsTravelledPerTick;
         *      }
         *      this.spaceshipExactPosition += a * this.shipToTargetDistance;
         *  }
         *  this.spaceshipExactPosition += new Vector3(0f, 5.1f, 0f);
         * }
         */

        public void ComputeShipShadowExactPosition()
        {
            GenCelestial.LightInfo lightSourceInfo = GenCelestial.GetLightSourceInfo(base.Map, GenCelestial.LightType.Shadow);
            this.shadowExactPosition = this.exactPosition + (Mathf.Max(0.5f, this.def.skyfaller.zPositionCurve.Evaluate(this.TimeInAnimation)) * new Vector3(lightSourceInfo.vector.x, -0.1f, lightSourceInfo.vector.y));
        }
コード例 #28
0
        public new void DrawDropSpotShadow(Vector3 center, Rot4 rot, Material material, Vector2 shadowSize, int ticksToImpact)
        {
            if (rot.IsHorizontal)
            {
                Gen.Swap <float>(ref shadowSize.x, ref shadowSize.y);
            }
            ticksToImpact = Mathf.Max(ticksToImpact, 0);
            Vector3 pos = center;

            pos.y = AltitudeLayer.Shadows.AltitudeFor();
            float   num   = 1f + (float)ticksToImpact / 100f;
            Vector3 s     = new Vector3(num * shadowSize.x, 1f, num * shadowSize.y);
            Color   white = Color.white;

            if (ticksToImpact > 150)
            {
                white.a = Mathf.InverseLerp(200f, 150f, (float)ticksToImpact);
            }
            DropShipLeaving.shadowPropertyBlock.SetColor(ShaderPropertyIDs.Color, white);
            this.shadowMatrix.SetTRS(this.ShadowDrawPos + Altitudes.AltIncVect, this.angle.ToQuat(), this.shadowScale);
            Graphics.DrawMesh(MeshPool.plane10, this.shadowMatrix, FadedMaterialPool.FadedVersionOf(this.ShadowMaterial, 0.4f * GenCelestial.CurShadowStrength(base.Map)), 0);
            Matrix4x4 matrix = default(Matrix4x4);

            /*
             * matrix.SetTRS(pos, rot.AsQuat, s);
             * Graphics.DrawMesh(MeshPool.plane10Back, matrix, material, 0, null, 0, DropShipLeaving.shadowPropertyBlock);
             */
        }
コード例 #29
0
        public void DrawDropSpotShadow(Vector3 center, float rot, Material material, Vector2 shadowSize, int ticksToImpact, bool flip)
        {
            if (base.Rotation.IsHorizontal)
            {
                Gen.Swap <float>(ref shadowSize.x, ref shadowSize.y);
            }
            ticksToImpact = Mathf.Max(ticksToImpact, 0);
            Vector3 pos = center;

            pos.y = AltitudeLayer.Shadows.AltitudeFor();
            //    float num = 1f + (float)ticksToImpact / 100f;
            float f   = !this.def.skyfaller.zPositionCurve.EnumerableNullOrEmpty() ? this.def.skyfaller.zPositionCurve.Evaluate(this.TimeInAnimation) : this.TimeInAnimation;
            float num = 1f + Mathf.Max(0.25f, f) / 100f;
            //    shadow = 1f * (float)ticksToImpact / 100f;
            Vector3 s     = new Vector3(num * shadowSize.x, 1f, num * shadowSize.y);
            Color   white = Color.white;

            if (ticksToImpact > 150)
            {
                white.a = Mathf.InverseLerp(200f, 150f, (float)ticksToImpact);
            }
            DropShipIncoming.shadowPropertyBlock.SetColor(ShaderPropertyIDs.Color, white);
            this.shadowMatrix.SetTRS(this.ShadowDrawPos + Altitudes.AltIncVect, (-rot).ToQuat(), s);
            Graphics.DrawMesh(MeshPool.plane10, this.shadowMatrix, FadedMaterialPool.FadedVersionOf(material, 0.4f * GenCelestial.CurShadowStrength(base.Map)), 0, null, 0);

            /*
             * matrix.SetTRS(pos, rot.AsQuat, s);
             * Graphics.DrawMesh(MeshPool.plane10Back, matrix, material, 0, null, 0, DropShipLeaving.shadowPropertyBlock);
             */
        }
コード例 #30
0
        public override void CompTick()
        {
            base.CompTick();
            if (!waitingForNight && this.parent.IsHashIntervalTick(Props.checkingInterval) && this.parent.Map != null &&
                (!Props.requiresTamed || (Props.requiresTamed && this.parent.Faction != null && this.parent.Faction.IsPlayer)))
            {
                IncidentDef incidentDef = IncidentDef.Named(Props.incidentToCause);

                if (incidentDef.defName == "Aurora")
                {
                    waitingForNight = true;
                }
                else
                {
                    IncidentParms parms = StorytellerUtility.DefaultParmsNow(incidentDef.category, this.parent.Map);
                    incidentDef.Worker.TryExecute(parms);
                }
            }
            if (waitingForNight && this.parent.IsHashIntervalTick(this.checkingForNightInterval) && this.parent.Map != null && GenCelestial.CurCelestialSunGlow(this.parent.Map) <= 0.4f &&
                (!Props.requiresTamed || (Props.requiresTamed && this.parent.Faction != null && this.parent.Faction.IsPlayer)))
            {
                IncidentDef   incidentDef = IncidentDef.Named(Props.incidentToCause);
                IncidentParms parms       = StorytellerUtility.DefaultParmsNow(incidentDef.category, this.parent.Map);
                incidentDef.Worker.TryExecute(parms);
                waitingForNight = false;
            }
        }