namespace VRTK.Prefabs.Locomotion.DestinationLocations { using UnityEngine; using UnityEngine.Events; using Malimbe.MemberChangeMethod; using Malimbe.MemberClearanceMethod; using Malimbe.XmlDocumentationAttribute; using Malimbe.PropertySerializationAttribute; using Zinnia.Rule; using Zinnia.Data.Attribute; /// /// The public interface into the DestinationLocation Prefab. /// public class DestinationLocationFacade : MonoBehaviour { #region Location Settings /// /// Determines if the location is in the locked and unusable state. /// [Serialized] [field: Header("Location Settings"), DocumentedByXml] public bool IsLocked { get; set; } /// /// Whether to apply the rotation of the custom destination location to the selected action output. /// [Serialized] [field: DocumentedByXml] public bool ApplyDestinationRotation { get; set; } = true; /// /// Allows to optionally determine which sources can affect the location. /// [Serialized, Cleared] [field: DocumentedByXml] public RuleContainer SourceValidity { get; set; } #endregion #region Location Events /// /// Emitted when the Destination Location is entered for the first time. /// [Header("Location Events"), DocumentedByXml] public UnityEvent HoverActivated = new UnityEvent(); /// /// Emitted when the Destination Location is entered. /// [DocumentedByXml] public DestinationLocation.SurfaceDataUnityEvent Entered = new DestinationLocation.SurfaceDataUnityEvent(); /// /// Emitted when the Destination Location is exited. /// [DocumentedByXml] public DestinationLocation.SurfaceDataUnityEvent Exited = new DestinationLocation.SurfaceDataUnityEvent(); /// /// Emitted when the Destination Location is exited for the last time. /// [DocumentedByXml] public UnityEvent HoverDeactivated = new UnityEvent(); /// /// Emitted when the Destination Location is activated. /// [DocumentedByXml] public DestinationLocation.TransformDataUnityEvent Activated = new DestinationLocation.TransformDataUnityEvent(); /// /// Emitted when the Destination Location is deactivated. /// [DocumentedByXml] public UnityEvent Deactivated = new UnityEvent(); #endregion #region Reference Settings /// /// The linked Internal Setup. /// [Serialized, Cleared] [field: Header("Reference Settings"), DocumentedByXml, Restricted] public DestinationLocationConfigurator Configuration { get; protected set; } #endregion /// /// Called after has been changed. /// [CalledAfterChangeOf(nameof(IsLocked))] protected virtual void OnAfterIsLockedChange() { Configuration.SetLockedState(IsLocked); } /// /// Called after has been changed. /// [CalledAfterChangeOf(nameof(ApplyDestinationRotation))] protected virtual void OnAfterApplyDestinationRotationChange() { Configuration.LocationController.ApplyDestinationRotation = ApplyDestinationRotation; } /// /// Called after has been changed. /// [CalledAfterChangeOf(nameof(SourceValidity))] protected virtual void OnAfterSourceValidityChange() { Configuration.LocationController.SourceValidity = SourceValidity; } } }