Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- using System.Collections;
- using RootMotion.FinalIK;
- #if UNITY_EDITOR
- using UnityEditor;
- #endif
- namespace AC
- {
- [System.Serializable]
- public class FinalIK_RunInteraction : Action
- {
- public bool isPlayer;
- public InteractionSystem interactionSystem;
- public FullBodyBipedEffector effector;
- public InteractionObject interactionObject;
- public bool canInterrupt;
- public FinalIK_RunInteraction()
- {
- this.isDisplayed = true;
- category = ActionCategory.Custom;
- title = "Final IK - Run interaction";
- description = "Starts an interaction using the Final IK Interaction System";
- isPlayer = true;
- canInterrupt = true;
- }
- override public float Run()
- {
- if (isPlayer)
- {
- interactionSystem = KickStarter.player.GetComponent<InteractionSystem>();
- if (interactionSystem == null)
- {
- Debug.LogWarning("FinalIK_RunInteraction: No InteractionSystem found on Player.");
- return 0f;
- }
- }
- else if (interactionSystem == null)
- {
- Debug.LogWarning("FinalIK_RunInteraction: No InteractionSystem defined.");
- return 0f;
- }
- if (interactionObject == null)
- {
- Debug.LogWarning("FinalIK_RunInteraction: No InteractionObject defined.");
- return 0f;
- }
- interactionSystem.StartInteraction(effector, interactionObject, canInterrupt);
- return 0f;
- }
- override public void Skip(){
- }
- #if UNITY_EDITOR
- override public void ShowGUI()
- {
- isPlayer = EditorGUILayout.Toggle("Is player?", isPlayer);
- if (!isPlayer)
- {
- interactionSystem = (InteractionSystem)EditorGUILayout.ObjectField("Character:", interactionSystem, typeof(InteractionSystem), true);
- }
- effector = (FullBodyBipedEffector)EditorGUILayout.EnumPopup("Effector:", effector);
- interactionObject = (InteractionObject)EditorGUILayout.ObjectField("Interaction object:", interactionObject, typeof(InteractionObject), true);
- canInterrupt = EditorGUILayout.Toggle("Can interrupt?", canInterrupt);
- AfterRunningOption();
- }
- #endif
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement