namespace VRTK.Prefabs.Pointers
{
using UnityEngine;
using Malimbe.XmlDocumentationAttribute;
using Malimbe.PropertySerializationAttribute;
using Malimbe.MemberClearanceMethod;
using Malimbe.MemberChangeMethod;
using Zinnia.Rule;
using Zinnia.Action;
using Zinnia.Pointer;
using Zinnia.Data.Attribute;
///
/// The public interface into the Pointer Prefab.
///
public class PointerFacade : MonoBehaviour
{
///
/// The pointer selection type.
///
public enum SelectionType
{
///
/// Initiates the select action when the selection action is activated (e.g. button pressed).
///
SelectOnActivate,
///
/// Initiates the select action when the selection action is deactivated (e.g. button released).
///
SelectOnDeactivate
}
#region Pointer Settings
///
/// The source for the pointer origin to follow.
///
[Serialized, Cleared]
[field: Header("Pointer Settings"), DocumentedByXml]
public GameObject FollowSource { get; set; }
///
/// The that will activate/deactivate the pointer.
///
[Serialized, Cleared]
[field: DocumentedByXml]
public BooleanAction ActivationAction { get; set; }
///
/// The that initiates the pointer selection.
///
[Serialized, Cleared]
[field: DocumentedByXml]
public BooleanAction SelectionAction { get; set; }
///
/// The action moment when to initiate the select action.
///
[Serialized]
[field: DocumentedByXml]
public SelectionType SelectionMethod { get; set; }
///
/// Allows to optionally determine targets based on the set rules.
///
[Serialized, Cleared]
[field: DocumentedByXml]
public RuleContainer TargetValidity { get; set; }
#endregion
#region Pointer Events
///
/// Emitted when the becomes active.
///
[Header("Pointer Events"), DocumentedByXml]
public ObjectPointer.UnityEvent Activated = new ObjectPointer.UnityEvent();
///
/// Emitted when the is deactivated.
///
[DocumentedByXml]
public ObjectPointer.UnityEvent Deactivated = new ObjectPointer.UnityEvent();
///
/// Emitted when the collides with a new target.
///
[DocumentedByXml]
public ObjectPointer.UnityEvent Entered = new ObjectPointer.UnityEvent();
///
/// Emitted when the stops colliding with an existing target.
///
[DocumentedByXml]
public ObjectPointer.UnityEvent Exited = new ObjectPointer.UnityEvent();
///
/// Emitted when the changes its hovering position over an existing target.
///
[DocumentedByXml]
public ObjectPointer.UnityEvent HoverChanged = new ObjectPointer.UnityEvent();
///
/// Emitted whenever is called.
///
[DocumentedByXml]
public ObjectPointer.UnityEvent Selected = new ObjectPointer.UnityEvent();
#endregion
#region Reference Settings
///
/// The linked Internal Setup.
///
[Serialized]
[field: Header("Reference Settings"), DocumentedByXml, Restricted]
public PointerConfigurator Configuration { get; protected set; }
#endregion
///
/// Called after has been changed.
///
[CalledAfterChangeOf(nameof(FollowSource))]
protected virtual void OnAfterFollowSourceChange()
{
Configuration.ConfigureFollowSources();
}
///
/// Called after has been changed.
///
[CalledAfterChangeOf(nameof(ActivationAction))]
protected virtual void OnAfterActivationActionChange()
{
Configuration.ConfigureActivationAction();
}
///
/// Called after has been changed.
///
[CalledAfterChangeOf(nameof(SelectionAction))]
protected virtual void OnAfterSelectionActionChange()
{
Configuration.ConfigureSelectionAction();
}
///
/// Called after has been changed.
///
[CalledAfterChangeOf(nameof(SelectionMethod))]
protected virtual void OnAfterSelectionMethodChange()
{
Configuration.ConfigureSelectionType();
}
///
/// Called after has been changed.
///
[CalledAfterChangeOf(nameof(TargetValidity))]
protected virtual void OnAfterTargetValidityChange()
{
Configuration.ConfigureTargetValidity();
}
}
}