You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
706 B

  1. using System;
  2. using UnityEngine;
  3. namespace UnityStandardAssets.Effects
  4. {
  5. public class ParticleSystemMultiplier : MonoBehaviour
  6. {
  7. // a simple script to scale the size, speed and lifetime of a particle system
  8. public float multiplier = 1;
  9. private void Start()
  10. {
  11. var systems = GetComponentsInChildren<ParticleSystem>();
  12. foreach (ParticleSystem system in systems)
  13. {
  14. system.startSize *= multiplier;
  15. system.startSpeed *= multiplier;
  16. system.startLifetime *= Mathf.Lerp(multiplier, 1, 0.5f);
  17. system.Clear();
  18. system.Play();
  19. }
  20. }
  21. }
  22. }