FTME01_LoopSwitch.cs 699 B

1234567891011121314151617181920212223242526272829
  1. using UnityEngine;
  2. using System.Collections;
  3. using ParticlePlayground;
  4. public class FTME01_LoopSwitch : MonoBehaviour {
  5. public float loopOffTiming = 0;
  6. float currentTime;
  7. public Transform parentTransform;
  8. PlaygroundParticlesC[] particleSystems;
  9. // Use this for initialization
  10. void Start () {
  11. particleSystems = parentTransform.GetComponentsInChildren<PlaygroundParticlesC>();
  12. currentTime = 0;
  13. }
  14. // Update is called once per frame
  15. void Update () {
  16. if (loopOffTiming != 0) {
  17. currentTime += Time.deltaTime;
  18. if (currentTime > loopOffTiming) {
  19. foreach (PlaygroundParticlesC particles in particleSystems)
  20. particles.loop = false;
  21. }
  22. }
  23. }
  24. }