SFX_ParticleSystemMeshAttacher.cs 893 B

12345678910111213141516171819202122232425
  1. using UnityEngine;
  2. // ReSharper disable once CheckNamespace
  3. namespace QFX.SFX
  4. {
  5. public static class SFX_ParticleSystemMeshAttacher
  6. {
  7. public static void Attach(ParticleSystem particleSystem, MeshRenderer meshRenderer, float normalOffset)
  8. {
  9. var psShape = particleSystem.shape;
  10. psShape.shapeType = ParticleSystemShapeType.MeshRenderer;
  11. psShape.normalOffset = normalOffset;
  12. psShape.meshRenderer = meshRenderer;
  13. }
  14. public static void Attach(ParticleSystem particleSystem, SkinnedMeshRenderer skinnedMeshRenderer,
  15. float normalOffset)
  16. {
  17. var psShape = particleSystem.shape;
  18. psShape.shapeType = ParticleSystemShapeType.SkinnedMeshRenderer;
  19. psShape.normalOffset = normalOffset;
  20. psShape.skinnedMeshRenderer = skinnedMeshRenderer;
  21. }
  22. }
  23. }