|
- using System;
- using UnityEngine;
-
- public class SpawnedParticles : MonoBehaviour
- {
- public virtual void Play()
- {
- int i = 0;
- int num = this._particleSystems.Length;
- while (i < num)
- {
- this._particleSystems[i].Play();
- i++;
- }
- UnityEngine.Object.Destroy(base.gameObject, this.GetLongestDuration());
- }
-
- private float GetLongestDuration()
- {
- float num = float.MinValue;
- int i = 0;
- int num2 = this._particleSystems.Length;
- while (i < num2)
- {
- ParticleSystem.MainModule main = this._particleSystems[i].main;
- num = Mathf.Max(num, main.duration + main.startLifetime.constantMax);
- i++;
- }
- return num;
- }
-
- [SerializeField]
- private ParticleSystem[] _particleSystems;
- }
|