interface MAGES::IInteractor

Overview

Interface that should be implemented by all interactor objects. More…

interface IInteractor
{
    // properties

    IInteractionManager InteractionManager;
    Transform Transform;
    Rigidbody Rigidbody;
    List Colliders;
    UnityEvent<InteractorRegisterEventArgs> RegisterEntered;
    UnityEvent<InteractorDeregisterEventArgs> DeregisterEntered;
    UnityEvent<HoverEnterInteractionEventArgs> HoverEntered;
    UnityEvent<HoverExitInteractionEventArgs> HoverExited;
    UnityEvent<SelectEnterInteractionEventArgs> SelectEntered;
    UnityEvent<SelectExitInteractionEventArgs> SelectExited;
    UnityEvent<ActivateEnterInteractionEventArgs> ActivateEntered;
    UnityEvent<ActivateExitInteractionEventArgs> ActivateExited;
    bool IsHoverEnabled;
    bool HasHover;
    IInteractable HoveredInteractable;
    bool IsSelectEnabled;
    bool HasSelection;
    IInteractable SelectedInteractable;
    float SelectionIntensity;
    bool IsActivateEnabled;
    bool HasActivation;
    IInteractable ActivatedInteractable;
    float ActivationIntensity;

    // methods

    bool CanHover(IInteractable interactable);
    bool IsHovering(IInteractable interactable);
    void OnHoverEnter(HoverEnterInteractionEventArgs args);
    void OnHoverEntered(HoverEnterInteractionEventArgs args);
    void OnHoverExit(HoverExitInteractionEventArgs args);
    void OnHoverExited(HoverExitInteractionEventArgs args);
    bool CanSelect(IInteractable interactable);
    bool IsSelecting(IInteractable interactable);
    void OnSelectEnter(SelectEnterInteractionEventArgs args);
    void OnSelectEntered(SelectEnterInteractionEventArgs args);
    void OnSelectExit(SelectExitInteractionEventArgs args);
    void OnSelectExited(SelectExitInteractionEventArgs args);
    bool CanActivate(IInteractable interactable);
    bool IsActivating(IInteractable interactable);
    void OnActivateEnter(ActivateEnterInteractionEventArgs args);
    void OnActivateEntered(ActivateEnterInteractionEventArgs args);
    void OnActivateExit(ActivateExitInteractionEventArgs args);
    void OnActivateExited(ActivateExitInteractionEventArgs args);
    void OnRegisterEnter(InteractorRegisterEventArgs args);
    void OnRegisterEntered(InteractorRegisterEventArgs args);
    void OnDeregisterEnter(InteractorDeregisterEventArgs args);
    void OnDeregisterEntered(InteractorDeregisterEventArgs args);
    void GetValidTargets(List<IInteractable> result);
    void PreprocessInteractor(UpdatePhase updatePhase);
    void ProcessInteractor(UpdatePhase updatePhase);
};

// direct descendants

interface IControllerInteractor;
class BaseInteractor;

Detailed Documentation

Interface that should be implemented by all interactor objects.

Properties

IInteractionManager InteractionManager

Gets the interaction manager this interactable is registered with. Null if not registered.

Transform Transform

Gets or sets the transform of the Interactor.

Rigidbody Rigidbody

Gets or sets the rigidbody of the Interactor.

List Colliders

Gets a list of all the colliders of the Interactor.

UnityEvent<InteractorRegisterEventArgs> RegisterEntered

Gets or sets the UnityEvent invoked when the interactor is registered to an IInteractionManager.

UnityEvent<InteractorDeregisterEventArgs> DeregisterEntered

Gets or sets the UnityEvent invoked when the interactor is deregistered from an IInteractionManager.

UnityEvent<HoverEnterInteractionEventArgs> HoverEntered

Gets or sets the UnityEvent invoked after the interactor begins hovering an IInteractable.

UnityEvent<HoverExitInteractionEventArgs> HoverExited

Gets or sets the UnityEvent invoked after the interactor ends hovering an IInteractable.

UnityEvent<SelectEnterInteractionEventArgs> SelectEntered

Gets or sets the UnityEvent invoked after the interactor begins selecting an IInteractable.

UnityEvent<SelectExitInteractionEventArgs> SelectExited

Gets or sets the UnityEvent invoked after the interactor ends selecting an IInteractable.

UnityEvent<ActivateEnterInteractionEventArgs> ActivateEntered

Gets or sets the UnityEvent invoked after the interactor begins activating an IInteractable.

UnityEvent<ActivateExitInteractionEventArgs> ActivateExited

Gets or sets the UnityEvent invoked after the interactor ends activating an IInteractable.

bool IsHoverEnabled

Gets a value indicating whether this interactor should send hover events.

bool HasHover

Gets a value indicating whether this interactor is hovering any interactable.

IInteractable HoveredInteractable

Gets all the interactables this interactor is currently hovering.

bool IsSelectEnabled

Gets a value indicating whether this interactor should send select event this frame.

Usually set by the controller input, when the grab button is pressed.

bool HasSelection

Gets a value indicating whether this interactor is selecting any interactable.

IInteractable SelectedInteractable

Gets the interactable this interactor has selected.

float SelectionIntensity

Gets the intensity of the selection.

bool IsActivateEnabled

Gets a value indicating whether this interactor should send activate event this frame.

Usually set by the controller input, when the grab button is pressed.

bool HasActivation

Gets a value indicating whether this interactor is activating any interactable.

IInteractable ActivatedInteractable

Gets the first interactable this interactor has activated.

float ActivationIntensity

Gets the intensity of the activation.

Methods

bool CanHover(IInteractable interactable)

Gets if this interactor can send hover events to the interactable.

Parameters:

interactable

The interactable to check if this interactor can send the hover event to.

Returns:

true if the interactable can be hovered by this interactor.

bool IsHovering(IInteractable interactable)

Gets if this interactor is hovering the interactable.

Parameters:

interactable

The interactable to check if this interactor is currently hovering over.

Returns:

true if the interactable is currently hovered by this interactor.

void OnHoverEnter(HoverEnterInteractionEventArgs args)

Called before the interactor sends a hover enter event to an interactable.

Parameters:

args

The event arguments.

void OnHoverEntered(HoverEnterInteractionEventArgs args)

Called after the interactor has sent a hover enter event to an interactable.

Parameters:

args

The event arguments.

void OnHoverExit(HoverExitInteractionEventArgs args)

Called before the interactor sends a hover exit event to an interactable.

Parameters:

args

The event arguments.

void OnHoverExited(HoverExitInteractionEventArgs args)

Called before the interactor sends a hover event to an interactable.

Parameters:

args

The event arguments.

bool CanSelect(IInteractable interactable)

Gets if this interactor can send select events to the interactable.

Parameters:

interactable

The interactable to check if this interactor can send the select event to.

Returns:

true if the interactable can be selected by this interactor.

bool IsSelecting(IInteractable interactable)

Gets if this interactor is selecting the interactable.

Parameters:

interactable

The interactable to check if this interactor is currently selecting.

Returns:

true if the interactable is currently selected by this interactor.

void OnSelectEnter(SelectEnterInteractionEventArgs args)

Called before the interactor sends a select enter event to an interactable.

Parameters:

args

The event arguments.

void OnSelectEntered(SelectEnterInteractionEventArgs args)

Called after the interactor sends a select enter event to an interactable.

Parameters:

args

The event arguments.

void OnSelectExit(SelectExitInteractionEventArgs args)

Called before the interactor sends a select exit event to an interactable.

Parameters:

args

The event arguments.

void OnSelectExited(SelectExitInteractionEventArgs args)

Called after the interactor sends a select exit event to an interactable.

Parameters:

args

The event arguments.

bool CanActivate(IInteractable interactable)

Gets if this interactor can send activate events to the interactable.

Parameters:

interactable

The interactable to check if this interactor can send the activate event to.

Returns:

true if the interactable can be activated by this interactor.

bool IsActivating(IInteractable interactable)

Gets if this interactor is activating the interactable.

Parameters:

interactable

The interactable to check if this interactor is currently activating.

Returns:

true if the interactable is currently activated by this interactor.

void OnActivateEnter(ActivateEnterInteractionEventArgs args)

Called before the interactor sends an activate enter event to an interactable.

Parameters:

args

The event arguments.

void OnActivateEntered(ActivateEnterInteractionEventArgs args)

Called after the interactor sends an activate enter event to an interactable.

Parameters:

args

The event arguments.

void OnActivateExit(ActivateExitInteractionEventArgs args)

Called before the interactor sends an activate exit event to an interactable.

Parameters:

args

The event arguments.

void OnActivateExited(ActivateExitInteractionEventArgs args)

Called after the interactor sends an activate exit event to an interactable.

Parameters:

args

The event arguments.

void OnRegisterEnter(InteractorRegisterEventArgs args)

Called before the interactor is registered with the InteractionManager.

Parameters:

args

The event arguments.

void OnRegisterEntered(InteractorRegisterEventArgs args)

Called after the interactor is registered with the InteractionManager.

Parameters:

args

The event arguments.

void OnDeregisterEnter(InteractorDeregisterEventArgs args)

Called before the interactor is deregistered from the InteractionManager.

Parameters:

args

The event arguments.

void OnDeregisterEntered(InteractorDeregisterEventArgs args)

Called after the interactor is deregistered from the InteractionManager.

Parameters:

args

The event arguments.

void GetValidTargets(List<IInteractable> result)

Returns the list of valid targets for this interactor in the current frame.

The result list is cleared before any interactables are added to it.

Parameters:

result

A list to put all the interactables this interactor may interact in this fram.

void PreprocessInteractor(UpdatePhase updatePhase)

Called by the InteractionManager before the Interactor is processed by the interaction manager, in the given update phase.

Parameters:

updatePhase

The update phase this method is called.

void ProcessInteractor(UpdatePhase updatePhase)

Called by the InteractionManager after the Interactor is processed by the interaction manager, in the given update phase.

Parameters:

updatePhase

The update phase this method is called.