57 lines
2.0 KiB
C#
57 lines
2.0 KiB
C#
using UnityEngine;
|
|
|
|
public class DynamicSnow_C : MonoBehaviour
|
|
{
|
|
private GameObject uniStormSystem;
|
|
|
|
public UniStormWeatherSystem_C uniStormSystemScript;
|
|
|
|
public float snowAmount;
|
|
|
|
private void Start()
|
|
{
|
|
uniStormSystem = GameObject.Find("UniStormSystemEditor");
|
|
uniStormSystemScript = uniStormSystem.GetComponent<UniStormWeatherSystem_C>();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (((uniStormSystemScript.weatherForecaster == 3 && uniStormSystemScript.temperature <= 32 && uniStormSystemScript.temperatureType == 1) || (uniStormSystemScript.weatherForecaster == 3 && uniStormSystemScript.temperature <= 0 && uniStormSystemScript.temperatureType == 2)) && uniStormSystemScript.minSnowIntensity >= 50f)
|
|
{
|
|
snowAmount += Time.deltaTime * 0.008f;
|
|
Shader.SetGlobalFloat("_LayerStrength", snowAmount);
|
|
if (snowAmount >= 0.6f)
|
|
{
|
|
snowAmount = 0.6f;
|
|
}
|
|
}
|
|
if (((uniStormSystemScript.weatherForecaster == 12 && uniStormSystemScript.temperature <= 32 && uniStormSystemScript.temperatureType == 1) || (uniStormSystemScript.weatherForecaster == 12 && uniStormSystemScript.temperature <= 0 && uniStormSystemScript.temperatureType == 2)) && uniStormSystemScript.minSnowIntensity >= 50f)
|
|
{
|
|
snowAmount += Time.deltaTime * 0.008f;
|
|
Shader.SetGlobalFloat("_LayerStrength", snowAmount);
|
|
if (snowAmount >= 0.6f)
|
|
{
|
|
snowAmount = 0.6f;
|
|
}
|
|
}
|
|
if (uniStormSystemScript.temperature > 32)
|
|
{
|
|
snowAmount -= Time.deltaTime * 0.008f;
|
|
Shader.SetGlobalFloat("_LayerStrength", snowAmount);
|
|
if (snowAmount <= 0f)
|
|
{
|
|
snowAmount = 0f;
|
|
}
|
|
}
|
|
if ((uniStormSystemScript.weatherForecaster == 2 && uniStormSystemScript.temperature <= 32 && uniStormSystemScript.temperatureType == 1) || (uniStormSystemScript.weatherForecaster == 2 && uniStormSystemScript.temperature <= 0 && uniStormSystemScript.temperatureType == 2))
|
|
{
|
|
snowAmount += Time.deltaTime * 0.008f;
|
|
Shader.SetGlobalFloat("_LayerStrength", snowAmount);
|
|
if (snowAmount >= 0.6f)
|
|
{
|
|
snowAmount = 0.6f;
|
|
}
|
|
}
|
|
}
|
|
}
|