/// <summary> /// Activates the motion on the specified target /// </summary> /// <param name="rTarget">GameObject to activate the motion on</param> /// <returns>Bool that determines if the motion was activated</returns> public bool ActivateInstance(GameObject rTarget) { bool lIsActivated = false; // Check if we have a motion controller and activate the motion MotionController lMotionController = rTarget.GetComponent <MotionController>(); if (lMotionController != null) { mMotion = lMotionController.ActivateMotion(MotionName); if (mMotion != null) { lIsActivated = true; // Clear out any event first, then add our event if (TargetTypeIndex == 0 || TargetTypeIndex == 1) { mMotion.OnDeactivatedEvent -= OnMotionDeactivated; mMotion.OnDeactivatedEvent += OnMotionDeactivated; } } // Grab the state as needed if (ExitState.Length > 0) { mExitStateID = lMotionController.AddAnimatorName(ExitState); } } return(lIsActivated); }