namespace VRTK.Prefabs.Locomotion.DestinationLocations { using UnityEngine; using Malimbe.XmlDocumentationAttribute; using Malimbe.PropertySerializationAttribute; using Zinnia.Data.Type; using Zinnia.Data.Attribute; /// /// Sets up the Destination Location Prefab based on the provided user settings. /// public class DestinationLocationConfigurator : MonoBehaviour { #region Facade Settings /// /// The public interface facade. /// [Serialized] [field: Header("Facade Settings"), DocumentedByXml, Restricted] public DestinationLocationFacade Facade { get; protected set; } #endregion #region Reference Settings /// /// The holding the visualizations for locked states. /// [Serialized] [field: Header("Reference Settings"), DocumentedByXml, Restricted] public GameObject LockedContainer { get; protected set; } /// /// The holding the visualizations for unlocked states. /// [Serialized] [field: DocumentedByXml, Restricted] public GameObject UnlockedContainer { get; protected set; } /// /// The that determines if the location is locked. /// [Serialized] [field: DocumentedByXml, Restricted] public DestinationLocationLockedStateTag LockedTag { get; protected set; } /// /// The that controls the functionality. /// [Serialized] [field: DocumentedByXml, Restricted] public DestinationLocation LocationController { get; protected set; } #endregion /// /// Sets the locked state of the Destination Location. /// /// public virtual void SetLockedState(bool isLocked) { LockedContainer.SetActive(isLocked); UnlockedContainer.SetActive(!isLocked); LockedTag.enabled = isLocked; } /// /// Emits the Hover Activated event. /// public virtual void EmitHoverActivated() { Facade.HoverActivated?.Invoke(); } /// /// Emits the Entered event. /// public virtual void EmitEntered(SurfaceData data) { Facade.Entered?.Invoke(data); } /// /// Emits the Exited event. /// public virtual void EmitExited(SurfaceData data) { Facade.Exited?.Invoke(data); } /// /// Emits the Hover Deactivated event. /// public virtual void EmitHoverDeactivated() { Facade.HoverDeactivated?.Invoke(); } /// /// Emits the Activated event. /// public virtual void EmitActivated(TransformData data) { Facade.Activated?.Invoke(data); } /// /// Emits the Deactivated event. /// public virtual void EmitDeactivated() { Facade.Deactivated?.Invoke(); } protected virtual void OnEnable() { SetLockedState(Facade.IsLocked); LocationController.SourceValidity = Facade.SourceValidity; LocationController.ApplyDestinationRotation = Facade.ApplyDestinationRotation; } } }