Exemple #1
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));
        }
Exemple #2
0
        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);
            }
        }
Exemple #3
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);
            }
        }
        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;
        }
 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);
 }
Exemple #6
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);
 }
Exemple #7
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));
        }