FTME01_ParticleScaler.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using UnityEngine;
  2. using System.Collections;
  3. using ParticlePlayground;
  4. public class FTME01_ParticleScaler : MonoBehaviour {
  5. public float scaleSize = 1f;
  6. public bool scaleVelocity = true;
  7. public bool scaleParticleSize = true;
  8. public bool scaleLifetimePositioning = true;
  9. public bool scaleOverflowOffset = true;
  10. public bool scaleScatterSize = true;
  11. float origVelocityScale;
  12. float origScale;
  13. float origLifetimePositioningScale;
  14. Vector3 origOverflowOffset;
  15. Vector3 origScatterScale;
  16. PlaygroundParticlesC particles;
  17. public void ParticleScaleOnEnable () {
  18. if (particles==null)
  19. particles = GetComponent<PlaygroundParticlesC>();
  20. origVelocityScale = particles.velocityScale;
  21. origScale = particles.scale;
  22. origLifetimePositioningScale = particles.lifetimePositioningScale;
  23. origOverflowOffset = particles.overflowOffset;
  24. origScatterScale = particles.scatterScale;
  25. }
  26. public void ParticleScaleOnDisable () {
  27. particles.velocityScale = origVelocityScale;
  28. particles.scale = origScale;
  29. particles.lifetimePositioningScale = origLifetimePositioningScale;
  30. particles.overflowOffset = origOverflowOffset;
  31. particles.scatterScale = origScatterScale;
  32. }
  33. public void ParticleScale () {
  34. if (scaleVelocity)
  35. particles.velocityScale = origVelocityScale*scaleSize;
  36. if (scaleParticleSize)
  37. particles.scale = origScale*scaleSize;
  38. if (scaleLifetimePositioning)
  39. particles.lifetimePositioningScale = origLifetimePositioningScale*scaleSize;
  40. if (scaleOverflowOffset)
  41. particles.overflowOffset = origOverflowOffset*scaleSize;
  42. if (scaleScatterSize)
  43. particles.scatterScale = origScatterScale*scaleSize;
  44. //scaleSize = 1f;
  45. }
  46. }