UniStorm Weather System Wiki
Advertisement

The great thing about UniStorm is its ability to be fully customizable, even programmatically. UniStorm has many variables that can be accessed through programming. Accessing in-game variables can also be useful to add to player immersion. We have tons of example scripts included with UniStorm that you can use as you please for your games. Feel free to also modify them as needed.

Accessing UniStorm

To access UniStorm, you will first need a reference to it. This can be done by using the following script:

using UnityEngine;
using System.Collections;

public class GetUniStormExample : MonoBehaviour {
	
	UniStormWeatherSystem_C UniStormSystem;
	
	void Start () 
	{
		//Get a reference to UniStorm
		UniStormSystem = GameObject.Find("UniStormSystemEditor").GetComponent<UniStormWeatherSystem_C>();
	}
}



Once you have done the above, you will be able to see all of UniStorm's API. Here's an example:

DisableParticles
GenerateWeather


Now that you have your first custom UniStorm script setup, you should be able to program it as you need. You can refer to the list of public functions below that should be able to accomplish most tasks.


UniStorm's Public Functions

As of UniStorm 2.4, there are now 12 public functions that can be accessed to do quite useful things. What each public function will be explained below.

  • ChangeWeather (int WeatherNumber) - Changes the weather by changing UniStorm's weatherForecaster variable. (List of possible weather types is included with the API)
  • ChangeWeather Instantly (int WeatherNumber) - Changes the weather instantly by changing UniStorm's weatherForecaster variable. (List of possible weather types is included with the API)
  • RandomWeather() - Changes the weather by generating a random weather type.
  • RandomNonPrecipitationWeather() - Changes the weather by generating a random non-precipitation weather type. (List of possible weather types is included with the API)
  • RandomPrecipitationWeather() - Changes the weather by generating a random precipitation or cloudy weather type. Note: Some weather types are dependent on the temperature and season. (List of possible weather types is included with the API)
  • GetDate() - Call this function to get UniStorm's current date and/or time using DateTime.
  • SetDate (int Month, int Day, int Year) - Changes UniStorm's date to the desired date by setting the Day, Month, and Year parameters.
  • SetTime (int Hour, int Minute) - Changes UniStorm's time to the desired time by setting the hour and minute parameters.
  • SetDateAndTime (int Hour, int Minute, int Month, int Day, int Year) - Changes UniStorm's current time and date. This is useful for applying a player's saved time and date.
  • SetDayAndNightLenth (int DayLength, int NightLength) - Changes the Day and Night lengths. This is useful for something like a resting system or an event where the time needs to be fast forwarded or slowed.
  • DisableParticleEffects() - Disables UniStorm's particle effects. This can be useful for events like entering areas where you don't want particle effects visible such as a building or cave.
  • EnableParticleEffects() - Enables UniStorm's particle effects. This can be useful for events like exiting areas where you previously had particle effects disabled such as in a building or cave.
  • GenerateWeather() - Generates a weather type using UniStorm's weather generating algorithm that takes in account the weather odds and time. Note: The generated weather will not happen right away. UniStorm will generate a weather change that will happen within the next 1 to 24 hours.
Advertisement