MegaShapeNGonEditor.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. 
  2. using UnityEditor;
  3. using UnityEngine;
  4. [CanEditMultipleObjects, CustomEditor(typeof(MegaShapeNGon))]
  5. public class MegaShapeNGonEditor : MegaShapeEditor
  6. {
  7. public float fillet = 0.0f;
  8. public int sides = 6;
  9. public bool circular = false;
  10. public bool scribe = false;
  11. public override bool Params()
  12. {
  13. MegaShapeNGon shape = (MegaShapeNGon)target;
  14. bool rebuild = false;
  15. float v = EditorGUILayout.FloatField("Radius", shape.radius);
  16. if ( v != shape.radius )
  17. {
  18. shape.radius = v;
  19. rebuild = true;
  20. }
  21. v = EditorGUILayout.FloatField("Fillet", shape.fillet);
  22. if ( v != shape.fillet )
  23. {
  24. shape.fillet = v;
  25. rebuild = true;
  26. }
  27. int iv = EditorGUILayout.IntField("Side", shape.sides);
  28. if ( iv != shape.sides )
  29. {
  30. shape.sides = iv;
  31. rebuild = true;
  32. }
  33. bool bv = EditorGUILayout.Toggle("Circular", shape.circular);
  34. if ( bv != shape.circular )
  35. {
  36. shape.circular = bv;
  37. rebuild = true;
  38. }
  39. bv = EditorGUILayout.Toggle("Circumscribed", shape.scribe);
  40. if ( bv != shape.scribe )
  41. {
  42. shape.scribe = bv;
  43. rebuild = true;
  44. }
  45. return rebuild;
  46. }
  47. }