namespace Tilia.Trackers.ColliderFollower { using UnityEngine; using Zinnia.Data.Type; using Zinnia.Extension; /// /// The public interface for the ColliderFollower prefab. /// public class ColliderFollowerFacade : MonoBehaviour { #region Tracking Settings [Header("Tracking Settings")] [Tooltip("The source to track.")] [SerializeField] private GameObject source; /// /// The source to track. /// public GameObject Source { get { return source; } set { source = value; if (this.IsMemberChangeAllowed()) { OnAfterSourceChange(); } } } [Tooltip("Whether to snap to source on enable.")] [SerializeField] private bool snapOnEnable; /// /// Whether to snap to source on enable. /// public bool SnapOnEnable { get { return snapOnEnable; } set { snapOnEnable = value; } } #endregion #region Reference Settings [Header("Reference Settings")] [Tooltip("The linked Internal Setup.")] [SerializeField] private ColliderFollowerConfigurator configuration; /// /// The linked Internal Setup. /// public ColliderFollowerConfigurator Configuration { get { return configuration; } protected set { configuration = value; } } [Tooltip("The GameObject reference for the nested Follow Tracking Container.")] [SerializeField] private ObjectReference linkedFollowTrackingContainer; /// /// The reference for the nested Follow Tracking Container. /// public ObjectReference LinkedFollowTrackingContainer { get { return linkedFollowTrackingContainer; } protected set { linkedFollowTrackingContainer = value; } } #endregion /// /// Clears . /// public virtual void ClearSource() { if (!this.IsValidState()) { return; } Source = default; } /// /// Snaps the tracked collider directly to the source current position. /// public virtual void SnapToSource() { Configuration.SnapToSource(); } /// /// Called after has been changed. /// protected virtual void OnAfterSourceChange() { Configuration.SetSource(Source); } } }