class MAGES::Interaction::Interactors::BaseInteractor

Overview

Base Interactor.

See also:

IInteractor More…

class BaseInteractor:
    public MonoBehaviour,
    public MAGES::IInteractor
{
public:
    // 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;
    float SelectionIntensity;
    IInteractable SelectedInteractable;
    bool IsActivateEnabled;
    bool HasActivation;
    float ActivationIntensity;
    IInteractable ActivatedInteractable;

    // methods

    virtual bool CanHover(IInteractable interactable);
    virtual bool CanSelect(IInteractable interactable);
    virtual bool CanActivate(IInteractable interactable);
    virtual abstract void GetValidTargets(List<IInteractable> result) = 0;
    bool IsActivating(IInteractable interactable);
    bool IsHovering(IInteractable interactable);
    bool IsSelecting(IInteractable interactable);
    virtual void PreprocessInteractor(UpdatePhase updatePhase);
    virtual void ProcessInteractor(UpdatePhase updatePhase);
};

// direct descendants

class BaseControllerInteractor;

Inherited Members

public:
    // 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);

Detailed Documentation

Base Interactor.

See also:

IInteractor

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.

float SelectionIntensity

Gets the intensity of the selection.

IInteractable SelectedInteractable

Gets the interactable this interactor has selected.

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.

float ActivationIntensity

Gets the intensity of the activation.

IInteractable ActivatedInteractable

Gets the first interactable this interactor has activated.

Methods

virtual 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.

virtual 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.

virtual 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.

virtual abstract void GetValidTargets(List<IInteractable> result) = 0

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.

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.

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.

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.

virtual 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.

virtual 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.