Files
Ultimate-Fishing-Simulator-…/Assets/Scripts/Assembly-CSharp/RainFX.cs
2026-03-04 09:37:33 +08:00

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();
}
}
}