34 lines
534 B
C#
34 lines
534 B
C#
using Obvious.Soap;
|
|
using UnityEngine;
|
|
|
|
public class RainFX : MonoBehaviour
|
|
{
|
|
public FloatVariable weather;
|
|
|
|
[SerializeField]
|
|
private ParticleSystem _particleSystem;
|
|
|
|
private void OnEnable()
|
|
{
|
|
WeatherOnOnValueChanged(weather.Value);
|
|
weather.OnValueChanged += WeatherOnOnValueChanged;
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
weather.OnValueChanged -= WeatherOnOnValueChanged;
|
|
}
|
|
|
|
private void WeatherOnOnValueChanged(float obj)
|
|
{
|
|
if (obj >= 2f)
|
|
{
|
|
_particleSystem.Play();
|
|
}
|
|
else
|
|
{
|
|
_particleSystem.Stop();
|
|
}
|
|
}
|
|
}
|