HingeJointInspector.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using bs;
  4. namespace bs.Editor
  5. {
  6. /** @addtogroup Inspectors
  7. * @{
  8. */
  9. /// <summary>
  10. /// Renders an inspector for the <see cref="HingeJoint"/> component.
  11. /// </summary>
  12. [CustomInspector(typeof(HingeJoint))]
  13. internal class HingeJointInspector : JointInspector
  14. {
  15. /// <inheritdoc/>
  16. protected internal override void Initialize()
  17. {
  18. HingeJoint joint = (HingeJoint)InspectedObject;
  19. BuildGUI(joint, true);
  20. drawer.AddDefault(joint, typeof(HingeJoint));
  21. drawer.AddField("Enable limit",
  22. () => joint.HasFlag(HingeJointFlag.Limit),
  23. x => joint.SetFlag(HingeJointFlag.Limit, x));
  24. drawer.AddConditional("Limit", () => joint.HasFlag(HingeJointFlag.Limit));
  25. drawer.AddField("Enable drive",
  26. () => joint.HasFlag(HingeJointFlag.Drive),
  27. x => joint.SetFlag(HingeJointFlag.Drive, x));
  28. drawer.AddConditional("Drive", () => joint.HasFlag(HingeJointFlag.Drive));
  29. }
  30. }
  31. /** @} */
  32. }