Exemplo n.º 1
0
        public TemperatureForecastForDay(int tileId, int ticks, int hour)
        {
            TileId = tileId;
            Ticks  = ticks;
            Hour   = hour;

            var outdoorTemperature = Find.World.tileTemperatures.OutdoorTemperatureAt(tileId, Ticks);

            OutdoorTemperature = GenTemperature.CelsiusTo(outdoorTemperature, Prefs.TemperatureMode);

            var offsetFromSunCycle = GenTemperature.OffsetFromSunCycle(Ticks, TileId);

            // this is a temperature delta, so it's not a straight Celsius to another temperature unit. We use an extension method.
            OffsetFromSunCycle = TemperatureDisplayMode.Celsius.TempDelta(offsetFromSunCycle, Prefs.TemperatureMode);

            var offsetFromDailyRandomVariation =
                Find.World.tileTemperatures.OffsetFromDailyRandomVariation(TileId, Ticks);

            OffsetFromDailyRandomVariation =
                TemperatureDisplayMode.Celsius.TempDelta(offsetFromDailyRandomVariation, Prefs.TemperatureMode);

            var offsetFromSeasonCycle = GenTemperature.OffsetFromSeasonCycle(Ticks, tileId);

            OffsetFromSeasonCycle = TemperatureDisplayMode.Celsius.TempDelta(offsetFromSeasonCycle, Prefs.TemperatureMode);

            var dailyRandomVariation = Find.WorldGrid[TileId].temperature -
                                       (OffsetFromSeasonCycle + OffsetFromDailyRandomVariation + OffsetFromSunCycle);

            DailyRandomVariation = TemperatureDisplayMode.Celsius.TempDelta(dailyRandomVariation, Prefs.TemperatureMode);
        }
            private float CalculateOutdoorTemperatureAtTile(int absTick, bool includeDailyVariations)
            {
                if (absTick == 0)
                {
                    absTick = 1;
                }
                float num = Find.WorldGrid[tile].temperature + GenTemperature.OffsetFromSeasonCycle(absTick, tile);

                if (includeDailyVariations)
                {
                    num += OffsetFromDailyRandomVariation(absTick) + GenTemperature.OffsetFromSunCycle(absTick, tile);
                }
                return(num);
            }
Exemplo n.º 3
0
        public TemperatureForecastForDay(int tileId, int ticks, int hour)
        {
            TileId = tileId;
            Ticks  = ticks;
            Hour   = hour;

            OutdoorTemperature             = Find.World.tileTemperatures.OutdoorTemperatureAt(tileId, Ticks);
            OffsetFromSunCycle             = GenTemperature.OffsetFromSunCycle(Ticks, TileId);
            OffsetFromDailyRandomVariation = Find.World.tileTemperatures.OffsetFromDailyRandomVariation(TileId,
                                                                                                        Ticks);
            OffsetFromSeasonCycle = GenTemperature.OffsetFromSeasonCycle(Ticks, tileId);

            var tile = Find.WorldGrid[TileId];

            DailyRandomVariation = tile.temperature -
                                   (OffsetFromSeasonCycle + OffsetFromDailyRandomVariation + OffsetFromSunCycle);
        }