theMessyCoder

CheckParticles

Jan 2nd, 2022 (edited)
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.15 KB | None | 0 0
  1. /*****************************************************
  2. // Author: The Messy Coder
  3. // Date: January 2022
  4. // For this video review: https://youtu.be/d8Oe1ydME7E
  5. // Please support by following on Twitch & social media
  6. // Twitch:   www.Twitch.tv/TheMessyCoder
  7. // YouTube:  www.YouTube.com/TheMessyCoder
  8. // Facebook: www.Facebook.com/TheMessyCoder
  9. // Twitter:  www.Twitter.com/TheMessyCoder
  10. *****************************************************/
  11.  
  12. using System.Collections;
  13. using System.Collections.Generic;
  14. using UnityEngine;
  15. using UnityEngine.Events;
  16.  
  17. namespace Messy
  18. {
  19.     public class CheckParticles : MonoBehaviour
  20.     {
  21.         public UnityEvent DoSomething;
  22.         public List<ParticleSystem> particles;
  23.  
  24.         public void CheckFlames()
  25.         {
  26.             int _checked = 0;
  27.  
  28.             foreach (var particle in particles)
  29.             {
  30.                 if (particle.isPlaying == true)
  31.                 {
  32.                     _checked++;
  33.                     continue;
  34.                 }
  35.             }
  36.             if (_checked == particles.Count)
  37.             {
  38.                 DoSomething.Invoke();
  39.             }
  40.         }
  41.     }
  42. }
Add Comment
Please, Sign In to add comment