namespace Zinnia.Tracking.Collision.Active.Operation.Extraction
{
using System;
using UnityEngine;
using UnityEngine.Events;
using Zinnia.Data.Operation.Extraction;
using Zinnia.Extension;
///
/// Extracts the of the from a given .
///
public class NotifierTargetExtractor : GameObjectExtractor
{
///
/// Defines the event with the specified .
///
[Serializable]
public class UnityEvent : UnityEvent { }
[Tooltip("Whether to extract the collder's compound parent, which is the GameObject that contains the collision Rigidbody.")]
[SerializeField]
private bool extractCompoundParent = true;
///
/// Whether to extract the collder's compound parent, which is the that contains the collision .
///
public bool ExtractCompoundParent
{
get
{
return extractCompoundParent;
}
set
{
extractCompoundParent = value;
}
}
///
protected override GameObject ExtractValue()
{
Transform containingTransform = Source != null ? (ExtractCompoundParent ? Source.ColliderData.GetContainingTransform() : Source.ColliderData.TryGetTransform()) : null;
return containingTransform != null ? containingTransform.gameObject : null;
}
}
}