private bool isDangerousWeather(Weather.weatherTypes weather) { bool dangerous = false; switch (weather) { case Weather.weatherTypes.ACID_RAIN: dangerous = true; break; case Weather.weatherTypes.BLIZZARD: dangerous = true; break; case Weather.weatherTypes.HELLFIRE: dangerous = true; break; case Weather.weatherTypes.SCARY_LIGHTNING: dangerous = true; break; } return(dangerous); }
private void setWeatherBasedParticles() { Weather.weatherTypes weather = calendar.getForecastWeather(0); WeatherVisuals visuals = gameObject.GetComponent <WeatherVisuals>(); visuals.updateWeatherParticles(weather); }
private GameObject getParticleFromWeather(Weather.weatherTypes weather) { GameObject particle = null; switch (weather) { case Weather.weatherTypes.ACID_RAIN: particle = acidRain; break; case Weather.weatherTypes.BLIZZARD: particle = blizzard; break; case Weather.weatherTypes.CLOUDY: particle = cloudy; break; case Weather.weatherTypes.RAIN: particle = rain; break; case Weather.weatherTypes.SNOW: particle = snow; break; default: particle = null; break; } return(particle); }
public void updateWeatherParticles(Weather.weatherTypes weather) { player = GameObject.FindGameObjectWithTag("Player"); ParticleSystem currentParticleScript = player.GetComponentInChildren <ParticleSystem>(); GameObject currentParticle = null; if (currentParticleScript != null) { currentParticle = currentParticleScript.gameObject; } GameObject newParticle = getParticleFromWeather(weather); if (!givenParticlesHaveSameName(currentParticle, newParticle)) { if (currentParticle != null) { Destroy(currentParticle); } if (newParticle != null) { GameObject part = Instantiate(newParticle, player.transform); ParticleSystem sys = part.GetComponent <ParticleSystem>(); sys.collision.SetPlane(0, player.transform); if (player.GetComponent <InBuilding>().getPlayerInBuilding()) { sys.Stop(); } } } }
private void removeStorms(GameObject target, float temp, Weather.weatherTypes weather) { GenericStorm[] storms = target.GetComponentsInChildren <GenericStorm>(); for (int i = 0; i < storms.Length; i++) { storms[i].removeStorm(); } }
public void increaseRandomWeatherChance() { Weather.weatherTypes[] weathers = (Weather.weatherTypes[])Enum.GetValues(typeof(Weather.weatherTypes)); int choice = UnityEngine.Random.Range(0, weathers.Length); Weather.weatherTypes weatherChoice = weathers[choice]; foreach (Weather.weatherTypes i in weathers) { chances[i] += 1; } }
private void addStorms(float temp, Weather.weatherTypes weather) { player = GameObject.FindGameObjectWithTag("Player"); if (temp > 30) { Instantiate(heatwaveStorm, player.transform.position, Quaternion.identity, player.transform); } if (temp < -10) { Instantiate(gatheringStorm, player.transform.position, Quaternion.identity, player.transform); } if (temp < -30) { Instantiate(frostbiteStorm, player.transform.position, Quaternion.identity, player.transform); } switch (weather) { case Weather.weatherTypes.ACID_RAIN: Instantiate(acidStorm, player.transform.position, Quaternion.identity, player.transform); break; case Weather.weatherTypes.BLIZZARD: Instantiate(blizzardStorm, player.transform.position, Quaternion.identity, player.transform); break; case Weather.weatherTypes.HELLFIRE: Instantiate(hellfireStorm, player.transform.position, Quaternion.identity, player.transform); break; case Weather.weatherTypes.PERFECT_WEATHER: Instantiate(perfectStorm, player.transform.position, Quaternion.identity, player.transform); break; case Weather.weatherTypes.SNOW: Instantiate(snowStorm, player.transform.position, Quaternion.identity, player.transform); break; default: break; } }
private void forecastWeather() { Weather.weatherTypes weatherToForecast = calendar.getForecastWeather(1); int endDay = Mathf.Min(4, calendar.getDaysToForecast()); for (int i = endDay; i > 1; i--) { if (isDangerousWeather(calendar.getForecastWeather(i))) { weatherToForecast = calendar.getForecastWeather(i); } } string weatherName = weatherToForecast.ToString(); weatherName = weatherName.ToLower(); weatherName = weatherName.Replace("_", "-"); rpgtalk.NewTalk(weatherName + "-forecast-start", weatherName + "-forecast-end"); }
public void SpawnMonsters(Weather.weatherTypes currentWeather) { if (currentWeather == Weather.weatherTypes.SUPER_HOT) { putMonsterOnMap(evilPenguin); } else if (currentWeather == Weather.weatherTypes.BLIZZARD) { putMonsterOnMap(evilPenguin); } else if (currentWeather == Weather.weatherTypes.ACID_RAIN) { putMonsterOnMap(evilPenguin); } else if (currentWeather == Weather.weatherTypes.HELLFIRE) { putMonsterOnMap(evilPenguin); } else if (currentWeather == Weather.weatherTypes.SCARY_LIGHTNING) { putMonsterOnMap(evilPenguin); } }
public void resetStorms(float temp, Weather.weatherTypes weather) { removeStorms(player, temp, weather); addStorms(temp, weather); }
public void updateWeatherName(Weather.weatherTypes type) { weatherNameText.text = type.ToString(); }