FANDOM


This is a small custom action for use in conjunction with the FinalIK Interactions Integration (AC Action) provided by Snebjorn. To use it, the interaction should be set to pause at whatever point you would like to run additional actions (for instance, if you want to animate the interaction object, call dialogue, etc. within an action list or cutscene rather than within the interaction system). When you want to resume/finish the interaction, use this custom action.

To use it replace the text in a .cs file named FinalIK_ResumeInteraction with this text, or create a new blank text file, then paste the text and rename the file FinalIK_ResumeInteraction.cs. Then drop the file into the folder named actions inside the Adventure creator folder.

This is the code:

using UnityEngine;
using System.Collections;
using RootMotion.FinalIK;

#if UNITY_EDITOR
using UnityEditor;
#endif
 
 namespace AC
 {
 	[System.Serializable]
 	public class FinalIK_ResumeInteraction : Action
 	{
 		public bool isPlayer;
 		public InteractionSystem interactionSystem;
 		public FullBodyBipedEffector effector;
 		
 		public FinalIK_ResumeInteraction()
 		{
 			this.isDisplayed = true;
 			category = ActionCategory.Custom;
 			title = "Final IK - Resume an interaction";
 			description = "Resumes a paused interaction using the Final IK Interaction System";
             isPlayer = 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;
 			}
 			
 			
 			interactionSystem.ResumeInteraction(effector);
 			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);
 		
 
 			AfterRunningOption();
 		}
 		#endif
 	}
 }


-Code provided by Larsos

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.