Exemplo n.º 1
0
        /// <summary>
        /// Processes the simulation for the specified date.
        /// </summary>
        ///
        /// <param name="date">The date to perform the simulation for.</param>
        public void Process(DateTime date)
        {
            if (calculator == null && DayNightProperties.instance != null)
            {
                calculator = new DayTimeCalculator(DayNightProperties.instance.m_Latitude);
            }

            if (calculator == null)
            {
                return;
            }

            float sunriseHour, sunsetHour;

            if (config.IsDynamicDayLengthEnabled)
            {
                calculator.Calculate(date, out sunriseHour, out sunsetHour);
            }
            else
            {
                if (SimulationManager.SUNRISE_HOUR == vanillaSunrise && SimulationManager.SUNSET_HOUR == vanillaSunset)
                {
                    return;
                }

                sunriseHour = vanillaSunrise;
                sunsetHour  = vanillaSunset;
            }

            SimulationManager.SUNRISE_HOUR = sunriseHour;
            SimulationManager.SUNSET_HOUR  = sunsetHour;

            SimulationManager.RELATIVE_DAY_LENGTH   = (int)(100f * (sunsetHour - sunriseHour) / 24f);
            SimulationManager.RELATIVE_NIGHT_LENGTH = 100 - SimulationManager.RELATIVE_DAY_LENGTH;
        }
Exemplo n.º 2
0
        public void Process(DateTime date)
        {
            if (calculator == null && DayNightProperties.instance != null)
            {
                calculator = new DayTimeCalculator(DayNightProperties.instance.m_Latitude);
            }

            if (calculator == null)
            {
                return;
            }

            calculator.Calculate(date, out float sunriseHour, out float sunsetHour);
            SimulationManager.SUNRISE_HOUR = sunriseHour;
            SimulationManager.SUNSET_HOUR  = sunsetHour;
        }