117 lines
1.7 KiB
C#
117 lines
1.7 KiB
C#
using UnityEngine;
|
|
|
|
public class WeatherSettings : MonoBehaviour
|
|
{
|
|
public float dayLength = 60f;
|
|
|
|
[Space(10f)]
|
|
public float hour = 12f;
|
|
|
|
public float temperature = 22f;
|
|
|
|
public float pressure;
|
|
|
|
public float clouds;
|
|
|
|
public float fog;
|
|
|
|
public int precipitation;
|
|
|
|
public bool isWinter;
|
|
|
|
public bool randomTest;
|
|
|
|
public float windStrength;
|
|
|
|
public float windDirection;
|
|
|
|
[Space(10f)]
|
|
public bool staticWeather = true;
|
|
|
|
public float randomTestDay = 0.9f;
|
|
|
|
public float randomTestNight = 0.66f;
|
|
|
|
private void Start()
|
|
{
|
|
}
|
|
|
|
public void SetHour(float value)
|
|
{
|
|
hour = value;
|
|
}
|
|
|
|
public void SetTemperature(float value)
|
|
{
|
|
temperature = value;
|
|
}
|
|
|
|
public void SetPressure(float value)
|
|
{
|
|
pressure = value;
|
|
}
|
|
|
|
public void SetWindStrength(float value)
|
|
{
|
|
windStrength = value;
|
|
}
|
|
|
|
public void SetWindDirection(float value)
|
|
{
|
|
windDirection = value;
|
|
}
|
|
|
|
public void SetClouds(float value)
|
|
{
|
|
clouds = value;
|
|
}
|
|
|
|
public void SetFog(float value)
|
|
{
|
|
fog = value;
|
|
}
|
|
|
|
public void SetPrecipitation(int value)
|
|
{
|
|
precipitation = value;
|
|
}
|
|
|
|
public void SetWinter(bool value)
|
|
{
|
|
isWinter = value;
|
|
}
|
|
|
|
public void SetStaticWeather(bool value)
|
|
{
|
|
staticWeather = value;
|
|
}
|
|
|
|
public void SetRandomTest(bool value)
|
|
{
|
|
randomTest = value;
|
|
}
|
|
|
|
public void GenerateRandomWeather()
|
|
{
|
|
if (!GlobalSettings.Instance.levelsManager.isTournament)
|
|
{
|
|
SetHour(7f);
|
|
}
|
|
SetTemperature(Random.Range(0, 3));
|
|
SetPressure(Random.Range(1000, 1050));
|
|
SetWindStrength(Random.Range(0f, 1f));
|
|
SetWindDirection(Random.Range(0f, 359f));
|
|
SetPrecipitation((Random.value < 0.15f) ? 1 : 0);
|
|
SetFog(Random.Range(0f, 1f));
|
|
if (precipitation == 0)
|
|
{
|
|
SetClouds(Random.Range(0, 4));
|
|
}
|
|
else
|
|
{
|
|
SetClouds(3f);
|
|
}
|
|
SetClouds(Random.Range(0f, 1f));
|
|
}
|
|
}
|