InteractionSystemTestGUI.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using UnityEngine;
  2. using System.Collections;
  3. using RootMotion.FinalIK;
  4. namespace RootMotion.Demos {
  5. /// <summary>
  6. /// Simple GUI for quickly testing out interactions.
  7. /// </summary>
  8. public class InteractionSystemTestGUI : MonoBehaviour {
  9. [Tooltip("The object to interact to")]
  10. public InteractionObject interactionObject;
  11. [Tooltip("The effectors to interact with")]
  12. public FullBodyBipedEffector[] effectors;
  13. private InteractionSystem interactionSystem;
  14. void Awake() {
  15. interactionSystem = GetComponent<InteractionSystem>();
  16. }
  17. void OnGUI() {
  18. if (interactionSystem == null) return;
  19. if (GUILayout.Button("Start Interaction With " + interactionObject.name)) {
  20. if (effectors.Length == 0) Debug.Log("Please select the effectors to interact with.");
  21. foreach (FullBodyBipedEffector e in effectors) {
  22. interactionSystem.StartInteraction(e, interactionObject, true);
  23. }
  24. }
  25. if (effectors.Length == 0) return;
  26. if (interactionSystem.IsPaused(effectors[0])) {
  27. if (GUILayout.Button("Resume Interaction With " + interactionObject.name)) {
  28. interactionSystem.ResumeAll();
  29. }
  30. }
  31. }
  32. }
  33. }