MegaShapeStarEditor.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. 
  2. using UnityEditor;
  3. using UnityEngine;
  4. [CanEditMultipleObjects, CustomEditor(typeof(MegaShapeStar))]
  5. public class MegaShapeStarEditor : MegaShapeEditor
  6. {
  7. public override bool Params()
  8. {
  9. MegaShapeStar shape = (MegaShapeStar)target;
  10. bool rebuild = false;
  11. float v = EditorGUILayout.FloatField("Radius1", shape.radius1);
  12. if ( v != shape.radius1 )
  13. {
  14. shape.radius1 = v;
  15. rebuild = true;
  16. }
  17. v = EditorGUILayout.FloatField("Radius2", shape.radius2);
  18. if ( v != shape.radius2 )
  19. {
  20. shape.radius2 = v;
  21. rebuild = true;
  22. }
  23. int iv = EditorGUILayout.IntField("Points", shape.points);
  24. if ( iv != shape.points )
  25. {
  26. shape.points = iv;
  27. rebuild = true;
  28. }
  29. v = EditorGUILayout.FloatField("Distortion", shape.distortion);
  30. if ( v != shape.distortion )
  31. {
  32. shape.distortion = v;
  33. rebuild = true;
  34. }
  35. v = EditorGUILayout.FloatField("Fillet Radius 1", shape.fillet1);
  36. if ( v != shape.fillet1 )
  37. {
  38. shape.fillet1 = v;
  39. rebuild = true;
  40. }
  41. v = EditorGUILayout.FloatField("Fillet Radius 2", shape.fillet2);
  42. if ( v != shape.fillet2 )
  43. {
  44. shape.fillet2 = v;
  45. rebuild = true;
  46. }
  47. return rebuild;
  48. }
  49. }