예제 #1
0
        /// <summary>
        /// Called by the weather system once it has calculated weather data.
        /// </summary>
        /// <param name="weather">The current weather system instance.</param>
        private void WeatherSystem_WeatherCalculated(WeatherSystem weather)
        {
            hasUpdatedWeather = true;

            switch (weather.GetCurrentWeather)
            {
            case Weather.Clear:     // Clear
                currentDaySheet = Resources.LoadAll <Sprite>(Global.SpritesheetResourcePath + clearDay.name);
                break;

            case Weather.Precipitation:     // Precipitation
                if (GameClock.Instance.GetSeason == Seasons.Winter)
                {
                    currentDaySheet = Resources.LoadAll <Sprite>(Global.SpritesheetResourcePath + snowyDay.name);
                }
                else
                {
                    currentDaySheet = Resources.LoadAll <Sprite>(Global.SpritesheetResourcePath + rainyDay.name);
                }
                break;

            case Weather.Stormy:     // Stormy
                currentDaySheet = Resources.LoadAll <Sprite>(Global.SpritesheetResourcePath + stormyDay.name);
                break;

            case Weather.Windy:     // Windy
                currentDaySheet = Resources.LoadAll <Sprite>(Global.SpritesheetResourcePath + windyDay.name);
                break;
            }

            UpdateImage();
        }
예제 #2
0
 private void OnDestroy()
 {
     if (Instance == this)
     {
         _Instance            = null;
         GameClock.NewSeason -= GameClock_NewSeason;
         GameClock.DayStart  -= GameClock_DayStart;
     }
 }
예제 #3
0
 private void Awake()
 {
     if (Instance == null)
     {
         _Instance            = this;
         GameClock.NewSeason += GameClock_NewSeason;
         GameClock.DayStart  += GameClock_DayStart;
     }
     else
     {
         Destroy(this);
     }
 }