/// <summary> /// Attempts to show the given <see cref="InteractorFacade"/>. /// </summary> /// <param name="interactorFacade">The interactor to show.</param> public virtual void Show(InteractorFacade interactorFacade) { if (Emit(showEmitter, interactorFacade)) { Shown?.Invoke(interactorFacade); } }
/// <summary> /// Attempts to hide the given <see cref="InteractorFacade"/>. /// </summary> /// <param name="interactorFacade">The interactor to hide.</param> public virtual void Hide(InteractorFacade interactorFacade) { if (Emit(hideEmitter, interactorFacade)) { Hidden?.Invoke(interactorFacade); } }
/// <summary> /// Attempts to emit the appropriate emitter for the given <see cref="InteractorFacade"/>. /// </summary> /// <param name="emitter">The event proxy to emit to.</param> /// <param name="interactorFacade">The interactor to emit with.</param> /// <returns><see langword="true"/> if the event is emitted.</returns> protected virtual bool Emit(InteractorFacadeEventProxyEmitter emitter, InteractorFacade interactorFacade) { if (!isActiveAndEnabled || emitter == null) { return(false); } emitter.Receive(interactorFacade); return(true); }
/// <summary> /// Extracts the attach point associated with the grabbing functionality of the Interactor. /// </summary> /// <param name="interactor">The Interactor to extract from.</param> /// <returns>The attach point.</returns> public virtual GameObject ExtractAttachPoint(InteractorFacade interactor) { if (interactor == null || interactor.grabInteractorSetup == null) { Result = null; return(null); } Result = interactor.grabInteractorSetup.attachPoint; return(base.Extract()); }
/// <summary> /// Extracts the <see cref="GameObject"/> the <see cref="InteractorFacade"/> is residing on. /// </summary> /// <param name="interactor">The Interactor to extract from.</param> /// <returns>The residing <see cref="GameObject"/>.</returns> public virtual GameObject Extract(InteractorFacade interactor) { if (interactor == null) { Result = null; return(null); } Result = interactor.gameObject; return(base.Extract()); }
/// <summary> /// Attempts to retrieve from a given GameObject. /// </summary> /// <param name="data">The GameObject to retreive from.</param> /// <param name="searchChildren">Optionally searches the children of the given GameObject.</param> /// <param name="searchParents">Optionally searches the parents of the given GameObject.</param> /// <returns>The found Interactor.</returns> public static InteractorFacade TryGetFromGameObject(GameObject data, bool searchChildren = true, bool searchParents = true) { InteractorFacade returnFacade = data.GetComponent <InteractorFacade>(); if (searchChildren && returnFacade == null) { returnFacade = data.GetComponentInChildren <InteractorFacade>(); } if (searchParents && returnFacade == null) { returnFacade = data.GetComponentInParent <InteractorFacade>(); } return(returnFacade); }
/// <summary> /// Extracts the attach point associated with the grabbing functionality of the Interactor. /// </summary> /// <param name="interactor">The Interactor to extract from.</param> public virtual void DoExtractAttachPoint(InteractorFacade interactor) { ExtractAttachPoint(interactor); }