namespace Tilia.Interactions.Interactables.Interactors.Operation.Extraction
{
using UnityEngine;
using Zinnia.Data.Operation.Extraction;
///
/// Extracts the grab attach point from an .
///
public class InteractorAttachPointExtractor : ComponentGameObjectExtractor
{
///
/// Extracts the attach point associated with the grabbing functionality of the Interactor.
///
/// The container that has an component to extract from.
/// The attach point.
public virtual GameObject Extract(GameObject interactorContainer)
{
return Extract(interactorContainer.GetComponent());
}
///
/// Extracts the attach point associated with the grabbing functionality of the Interactor.
///
/// The container that has an component to extract from.
public virtual void DoExtract(GameObject interactorContainer)
{
Extract(interactorContainer);
}
///
protected override GameObject ExtractValue()
{
if (Source.GetType() != typeof(InteractorFacade))
{
return null;
}
InteractorFacade interactorSource = (InteractorFacade)Source;
return interactorSource != null && interactorSource.GrabConfiguration != null
? GetValue(interactorSource)
: null;
}
///
/// Gets the source to extract.
///
/// The Interactor to extract from.
/// The grab attach point to return.
protected virtual GameObject GetValue(InteractorFacade interactorSource)
{
return interactorSource.GrabAttachPoint;
}
}
}