Esempio n. 1
0
        public void ClearWeather_instance_has_correct_values()
        {
            // Act
            var weather = new ClearWeather();

            // Assert
            Assert.AreEqual("Clear", weather.Name, "The weather name was not the correct name.");
            Assert.AreEqual(80, weather.OccurrenceProbability, "The probability of this weather occurring is incorrect.");
        }
Esempio n. 2
0
    protected void UpdateWeather(bool autoStart)
    {
        Weather newWeather = null;

        switch (weatherType)
        {
        case WeatherType.Clear:
        case WeatherType.Clear_Blue:
            newWeather = new ClearWeather();
            break;

        case WeatherType.Rain:
        case WeatherType.Heavy_Rain:
            newWeather = new RainWeather();
            break;

        case WeatherType.Snow:
        case WeatherType.Heavy_Snow:
            newWeather = new SnowWeather();
            break;

        case WeatherType.Cloudy:
        case WeatherType.Heavy_Cloudy:
            newWeather = new CloudyWeather();
            break;
        }

        if (newWeather != null)
        {
            if (weather != null)
            {
                weather.Stop(this, -1);
                activeWeathers.Add(weather);
            }
            weather = newWeather;
            weather.Init(this);
            if (autoStart)
            {
                weather.Start(this);
            }
        }
    }