using System; using UnityEngine; public class WeatherParticles : MonoBehaviour { protected virtual void Awake() { if (this.parentCamera == null) { if (base.transform.parent != null) { this.parentCamera = base.transform.parent.GetComponent(); } if (this.parentCamera == null) { UnityEngine.Debug.LogError("WeatherParticles: Failed to find parentCamera, please assign it manually"); } } this.PrecipitationPercentage = 0f; foreach (ParticleSystem particleSystem in this.particleLayers) { Renderer component = particleSystem.GetComponent(); if (component != null) { component.sortingOrder = this.sortingOrder; } } } protected virtual void Start() { } protected virtual void Update() { float num = this.parentCamera.orthographicSize / 600f; base.transform.localPosition = new Vector3(base.transform.localPosition.x, this.parentCamera.orthographicSize, 0f); base.transform.localScale = new Vector3(num, num, 1f); foreach (ParticleSystem particleSystem in this.particleLayers) { ParticleSystem.MainModule main = particleSystem.main; main.startSize = num * 100f; } } public float PrecipitationPercentage { set { foreach (ParticleSystem particleSystem in this.particleLayers) { var _temp_val_887 = particleSystem.emission; _temp_val_887.rateOverTime = new ParticleSystem.MinMaxCurve(value * this.maxEmission); } } } public Camera parentCamera; public ParticleSystem[] particleLayers; public float maxEmission; public int sortingOrder = 200; }