namespace VRTK.Prefabs.Interactions.Interactables { using UnityEngine; using UnityEngine.Events; using System; using Malimbe.XmlDocumentationAttribute; using Zinnia.Extension; /// /// Extracts the if one exists in the hierarchy of the given . /// public class InteractableFacadeExtractor : MonoBehaviour { /// /// Defines the event with the specified . /// [Serializable] public class UnityEvent : UnityEvent { } /// /// Emitted when the is extracted. /// [DocumentedByXml] public UnityEvent Extracted = new UnityEvent(); /// /// The extracted . /// public InteractableFacade Result { get; protected set; } /// /// Extracts the / /// /// The extracted . public virtual InteractableFacade Extract(GameObject container) { if (container == null) { Result = null; return null; } Result = container != null ? container.TryGetComponent(true, true) : null; if (!isActiveAndEnabled || Result == null) { Result = null; return null; } Extracted?.Invoke(Result); return Result; } /// /// Extracts the . /// public virtual void DoExtract(GameObject container) { Extract(container); } } }