public void applyWeatherCondition() { float debuffChance = 0f; switch (myWeatherController.getWeatherLevel()) { case 1: debuffChance = lv1DebuffChance; break; case 2: debuffChance = lv2DebuffChance; break; case 3: debuffChance = lv3DebuffChance; break; default: break; } if (Random.Range(0.0f, 1.0f) <= debuffChance) { switch (myWeatherController.GetCurWeather()) { case WeatherController.weatherList.Normal: curState = PlantState.Growing; break; case WeatherController.weatherList.AcidRain: curState = PlantState.Corrupting; break; case WeatherController.weatherList.SandStorm: curState = PlantState.Stifling; break; case WeatherController.weatherList.HighTemp: curState = PlantState.OverHeating; break; case WeatherController.weatherList.Cold: curState = PlantState.Freezing; break; default: break; } curDamage = myWeatherController.getCurDamage(); } }