namespace Tilia.Interactions.Interactables.Interactors.Operation.Extraction
{
using System;
using UnityEngine;
using Zinnia.Data.Operation.Extraction;
///
/// Extracts a relevant to the extraction method from an .
///
public class InteractorExtractor : ComponentGameObjectExtractor
{
///
/// The cached Grab Attach Point if trying to Extract Attach Point;
///
protected GameObject cachedGrabAttachPoint;
///
/// Extracts the attach point associated with the grabbing functionality of the Interactor.
///
/// The Interactor to extract from.
/// The attach point.
[Obsolete("Use `InteractorAttachPointExtractor.Extract()` instead.")]
public virtual GameObject ExtractAttachPoint(InteractorFacade interactor)
{
Debug.LogWarning("`InteractorExtractor.ExtractAttachPoint()` has been deprecated. Use `InteractorAttachPointExtractor.Extract()` instead.", gameObject);
if (interactor == null || interactor.GrabConfiguration == null)
{
Result = null;
return null;
}
cachedGrabAttachPoint = interactor.GrabAttachPoint;
return base.Extract();
}
///
/// Extracts the attach point associated with the grabbing functionality of the Interactor.
///
/// The Interactor to extract from.
[Obsolete("Use `InteractorAttachPointExtractor -> DoExtract` instead.")]
public virtual void DoExtractAttachPoint(InteractorFacade interactor)
{
ExtractAttachPoint(interactor);
}
///
/// Extracts the attach point associated with the grabbing functionality of the Interactor.
///
/// The container that has an component to extract from.
/// The attach point.
[Obsolete("Use `InteractorAttachPointExtractor -> Extract` instead.")]
public virtual GameObject ExtractAttachPoint(GameObject interactorContainer)
{
return ExtractAttachPoint(interactorContainer.GetComponent());
}
///
/// Extracts the attach point associated with the grabbing functionality of the Interactor.
///
/// The container that has an component to extract from.
[Obsolete("Use `InteractorAttachPointExtractor -> DoExtract` instead.")]
public virtual void DoExtractAttachPoint(GameObject interactorContainer)
{
ExtractAttachPoint(interactorContainer);
}
///
protected override GameObject ExtractValue()
{
if (cachedGrabAttachPoint != null)
{
GameObject toReturn = cachedGrabAttachPoint;
cachedGrabAttachPoint = null;
return toReturn;
}
return Source.GetType() == typeof(InteractorFacade) ? base.ExtractValue() : null;
}
}
}