ParticlesAreaEditor.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. using UnityEngine;
  2. using UnityEditor;
  3. using System.Collections;
  4. [CustomEditor(typeof(ParticlesArea))]
  5. public class ParticleAreaEditor : Editor {
  6. public override void OnInspectorGUI()
  7. {
  8. ParticlesArea sim = (ParticlesArea)target;
  9. /* if (SystemInfo.graphicsShaderLevel < 50)
  10. {
  11. EditorGUILayout.HelpBox("Cocuy needs DX11 enabled.", MessageType.Error);
  12. }
  13. else*/
  14. {
  15. base.OnInspectorGUI();
  16. float fMaxQuality = 2048.0f;
  17. float fMinQuality = 128.0f;
  18. sim.Resolution = (int)EditorGUILayout.Slider("Area Resolution", sim.Resolution, fMinQuality, fMaxQuality);
  19. float disp_min = 0.9f;
  20. float disp_max = 1.0f;
  21. float range = disp_max - disp_min;
  22. float density_dissipation = Mathf.Clamp(sim.Dissipation, disp_min, disp_max);
  23. density_dissipation = (density_dissipation - disp_min) / range;
  24. density_dissipation = EditorGUILayout.Slider("Particle Life", density_dissipation, 0.0f, 1.0f);
  25. sim.Dissipation = density_dissipation * range + disp_min;
  26. }
  27. EditorUtility.SetDirty(sim);
  28. }
  29. }