namespace VRTK.Prefabs.PlayAreaRepresentation { using UnityEngine; using Malimbe.XmlDocumentationAttribute; using Malimbe.PropertySerializationAttribute; using Zinnia.Data.Attribute; using Zinnia.Data.Operation.Mutation; using Zinnia.Data.Operation.Extraction; using Zinnia.Tracking.CameraRig.Operation.Extraction; /// /// Sets up the PlayAreaRepresentation Prefab based on the provided user settings. /// public class PlayAreaRepresentationConfigurator : MonoBehaviour { #region Facade Settings /// /// The public facade. /// [Serialized] [field: Header("Facade Settings"), DocumentedByXml, Restricted] public PlayAreaRepresentationFacade Facade { get; protected set; } #endregion #region Operator Settings /// /// The component for extracting the PlayArea dimension data. /// [Serialized] [field: Header("Operator Settings"), DocumentedByXml, Restricted] public PlayAreaDimensionsExtractor DimensionExtractor { get; protected set; } /// /// The component for scaling the given target. /// [Serialized] [field: DocumentedByXml, Restricted] public TransformScaleMutator ObjectScaler { get; protected set; } /// /// The component for positioning the given target. /// [Serialized] [field: DocumentedByXml, Restricted] public TransformPositionMutator ObjectPositioner { get; protected set; } /// /// The component extracting the offset origin position. /// [Serialized] [field: DocumentedByXml, Restricted] public TransformPositionExtractor OffsetOriginExtractor { get; protected set; } /// /// The component extracting the offset destination position. /// [Serialized] [field: DocumentedByXml, Restricted] public TransformPositionExtractor OffsetDestinationExtractor { get; protected set; } #endregion /// /// Configures the target settings. /// public virtual void ConfigureTarget() { ObjectScaler.Target = Facade.Target; ObjectPositioner.Target = Facade.Target; } /// /// Configures the offset origin settings. /// public virtual void ConfigureOffsetOrigin() { OffsetOriginExtractor.Source = Facade.OffsetOrigin; } /// /// Configures the offset destination settings. /// public virtual void ConfigureOffsetDestination() { OffsetDestinationExtractor.Source = Facade.OffsetDestination; } /// /// Recalculates the PlayArea dimensions. /// public virtual void RecalculateDimensions() { DimensionExtractor.DoExtract(); } protected virtual void OnEnable() { ConfigureTarget(); ConfigureOffsetOrigin(); ConfigureOffsetDestination(); ObjectScaler.gameObject.SetActive(true); } protected virtual void OnDisable() { ObjectScaler.gameObject.SetActive(false); } } }