AimIKInspector.cs 974 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. using UnityEditor;
  2. using UnityEngine;
  3. using System.Collections;
  4. namespace RootMotion.FinalIK {
  5. /*
  6. * Custom inspector for AimIK.
  7. * */
  8. [CustomEditor(typeof(AimIK))]
  9. public class AimIKInspector : IKInspector {
  10. private AimIK script { get { return target as AimIK; }}
  11. protected override MonoBehaviour GetMonoBehaviour(out int executionOrder) {
  12. executionOrder = 9997;
  13. return script;
  14. }
  15. protected override void OnApplyModifiedProperties() {
  16. if (!Application.isPlaying) script.solver.Initiate(script.transform);
  17. }
  18. protected override void AddInspector() {
  19. // Draw the inspector for IKSolverAim
  20. IKSolverAimInspector.AddInspector(solver, !Application.isPlaying);
  21. // Warning box
  22. string message = string.Empty;
  23. if (!script.solver.IsValid(ref message)) AddWarningBox(message);
  24. }
  25. void OnSceneGUI() {
  26. // Draw the scene veiw helpers
  27. IKSolverAimInspector.AddScene(script.solver, new Color(1f, 0f, 0.5f, 1f), true);
  28. }
  29. }
  30. }