Beispiel #1
0
        /// <summary>
        /// Triggers Events for Sunrise and Sunset
        /// </summary>
        private void InvokeDayTimeEvent()
        {
            if (_isNight && timeOfDay >= 0.25 && timeOfDay < 0.70)
            {
                _isNight = !_isNight;
                SunRise?.Invoke();
            }

            if (!_isNight && timeOfDay >= 0.70)
            {
                _isNight = !_isNight;
                SunSet?.Invoke();
            }

            if (!_moonShines && timeOfDay >= 0.85)
            {
                _moonShines = !_moonShines;
                MoonRise?.Invoke();
            }

            if (_moonShines && TimeOfDay > 0.15 && timeOfDay < 0.85)
            {
                _moonShines = !_moonShines;
                MoonSet?.Invoke();
            }
        }