csShurikenEffectChanger.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536
  1. using UnityEngine;
  2. #if UNITY_EDITOR
  3. using UnityEditor;
  4. public class csShurikenEffectChanger : MonoBehaviour
  5. {
  6. public void ShurikenParticleScaleChange(float _Value)
  7. {
  8. ParticleSystem[] ParticleSystems = GetComponentsInChildren<ParticleSystem>();
  9. transform.localScale *= _Value;
  10. foreach(ParticleSystem _ParticleSystem in ParticleSystems) {
  11. var main = _ParticleSystem.main;
  12. main.startSpeedMultiplier = _Value;
  13. main.startSizeMultiplier = _Value;
  14. main.gravityModifierMultiplier = _Value;
  15. SerializedObject _SerializedObject = new SerializedObject(_ParticleSystem);
  16. _SerializedObject.FindProperty("CollisionModule.particleRadius").floatValue *= _Value;
  17. _SerializedObject.FindProperty("ShapeModule.radius").floatValue *= _Value;
  18. _SerializedObject.FindProperty("ShapeModule.boxX").floatValue *= _Value;
  19. _SerializedObject.FindProperty("ShapeModule.boxY").floatValue *= _Value;
  20. _SerializedObject.FindProperty("ShapeModule.boxZ").floatValue *= _Value;
  21. _SerializedObject.FindProperty("VelocityModule.x.scalar").floatValue *= _Value;
  22. _SerializedObject.FindProperty("VelocityModule.y.scalar").floatValue *= _Value;
  23. _SerializedObject.FindProperty("VelocityModule.z.scalar").floatValue *= _Value;
  24. _SerializedObject.FindProperty("ClampVelocityModule.x.scalar").floatValue *= _Value;
  25. _SerializedObject.FindProperty("ClampVelocityModule.y.scalar").floatValue *= _Value;
  26. _SerializedObject.FindProperty("ClampVelocityModule.z.scalar").floatValue *= _Value;
  27. _SerializedObject.FindProperty("ClampVelocityModule.magnitude.scalar").floatValue *= _Value;
  28. _SerializedObject.ApplyModifiedProperties();
  29. }
  30. }
  31. }
  32. #endif