SplashVFXInspector.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // River Modeler
  2. // Staggart Creations (http://staggart.xyz)
  3. // Copyright protected under Unity Asset Store EULA
  4. // Copying or referencing source code for the production of new asset store content is strictly prohibited.
  5. using sc.modeling.river.runtime;
  6. using sc.modeling.water.common.editor;
  7. using UnityEditor;
  8. namespace sc.modeling.river.editor
  9. {
  10. [CustomEditor(typeof(SplashVFX))]
  11. [CanEditMultipleObjects]
  12. public class SplashVFXInspector : RiverVFXInspectorBase
  13. {
  14. private SerializedProperty foamThreshold;
  15. private SerializedProperty minMaxSlopeAngle;
  16. private SerializedProperty spawnChance;
  17. void OnEnable()
  18. {
  19. base.Enable();
  20. foamThreshold = serializedObject.FindProperty("foamThreshold");
  21. minMaxSlopeAngle = serializedObject.FindProperty("minMaxSlopeAngle");
  22. spawnChance = serializedObject.FindProperty("spawnChance");
  23. }
  24. public override void OnInspectorGUI()
  25. {
  26. base.OnInspectorGUI();
  27. serializedObject.Update();
  28. EditorGUI.BeginChangeCheck();
  29. EditorGUILayout.LabelField("Spawning Criteria", EditorStyles.boldLabel);
  30. EditorGUILayout.PropertyField(foamThreshold);
  31. EditorGUILayout.PropertyField(minMaxSlopeAngle);
  32. EditorGUILayout.PropertyField(spawnChance);
  33. if (EditorGUI.EndChangeCheck())
  34. {
  35. serializedObject.ApplyModifiedProperties();
  36. EditorApplication.delayCall += () =>
  37. {
  38. foreach (var m_target in targets)
  39. ((RiverVFX)m_target).GenerateEmitters();
  40. };
  41. }
  42. UI.DrawFooter();
  43. }
  44. }
  45. }