54 lines
1.6 KiB
C#
54 lines
1.6 KiB
C#
using System;
|
|
using UnityEngine;
|
|
|
|
[Serializable]
|
|
public class DynamicSnow_JS : MonoBehaviour
|
|
{
|
|
private GameObject uniStormSystem;
|
|
|
|
private UniStormWeatherSystem_JS uniStormSystemScript;
|
|
|
|
public float snowAmount;
|
|
|
|
public virtual void Start()
|
|
{
|
|
uniStormSystem = GameObject.Find("UniStormSystemEditor");
|
|
uniStormSystemScript = (UniStormWeatherSystem_JS)uniStormSystem.GetComponent(typeof(UniStormWeatherSystem_JS));
|
|
}
|
|
|
|
public virtual 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.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;
|
|
}
|
|
}
|
|
}
|
|
|
|
public virtual void Main()
|
|
{
|
|
}
|
|
}
|