interface MAGES::IInteractionManager

Overview

Interface for the Interaction Manager. More…

interface IInteractionManager
{
    // properties

    UnityEvent RegisterManagerEnter;
    UnityEvent DeregisterManagerEnter;
    UnityEvent<InteractorRegisterEventArgs> RegisterInteractorEnter;
    UnityEvent<InteractorDeregisterEventArgs> DeregisterInteractorEnter;
    UnityEvent<InteractableRegisterEventArgs> RegisterInteractableEnter;
    UnityEvent<InteractableDeregisterEventArgs> DeregisterInteractableEnter;
    UnityEvent<HoverEnterInteractionEventArgs> HoverEntered;
    UnityEvent<HoverExitInteractionEventArgs> HoverExited;
    UnityEvent<SelectEnterInteractionEventArgs> SelectEntered;
    UnityEvent<SelectExitInteractionEventArgs> SelectExited;
    UnityEvent<ActivateEnterInteractionEventArgs> ActivateEntered;
    UnityEvent<ActivateExitInteractionEventArgs> ActivateExited;

    // methods

    bool RegisterInteractor(IInteractor interactor);
    bool RegisterInteractable(IInteractable interactable);
    void DeregisterInteractor(IInteractor interactor);
    void DeregisterInteractable(IInteractable interactable);
    void RegisterManager(IInteractionManager manager);
    void DeregisterManager(IInteractionManager manager);
    void GetRegisteredInteractors(List<IInteractor> result);
    void GetRegisteredInteractables(List<IInteractable> result);
    bool IsInteractorRegistered(IInteractor interactor);
    bool IsInteractableRegistered(IInteractable interactable);

    bool TryGetInteractableFromCollider(
        Collider collider,
        out IInteractable interactable
    );

    bool TryGetInteractorFromCollider(
        Collider collider,
        out IInteractor interactable
    );

    bool HoverEnter(IInteractor interactor, IInteractable interactable);
    bool HoverExit(IInteractor interactor, IInteractable interactable);
    bool SelectEnter(IInteractor interactor, IInteractable interactable);
    bool SelectExit(IInteractor interactor, IInteractable interactable);
    bool ActivateEnter(IInteractor interactor, IInteractable interactable);
    bool ActivateExit(IInteractor interactor, IInteractable interactable);
};

// direct descendants

class InteractionManager;

Detailed Documentation

Interface for the Interaction Manager.

The interaction manager is a mediator between IInteractable and IInteractor. It is responsible for keeping track of all the registered interactors and interactables, and for notifying them for events, such as Hover, Select and Activate.

Properties

UnityEvent RegisterManagerEnter

Gets the event called when a manager is registered.

UnityEvent DeregisterManagerEnter

Gets the event called when a manager is deregistered.

UnityEvent<InteractorRegisterEventArgs> RegisterInteractorEnter

Gets the event called when an IInteractor is registered.

UnityEvent<InteractorDeregisterEventArgs> DeregisterInteractorEnter

Gets the event called when an IInteractor is deregistered.

UnityEvent<InteractableRegisterEventArgs> RegisterInteractableEnter

Gets the event called when an IInteractable is registered.

UnityEvent<InteractableDeregisterEventArgs> DeregisterInteractableEnter

Gets the event called when an IInteractable is deregistered.

UnityEvent<HoverEnterInteractionEventArgs> HoverEntered

Gets the event called when an IInteractor starts hovering an IInteractable.

UnityEvent<HoverExitInteractionEventArgs> HoverExited

Gets the event called when an IInteractor stops hovering an IInteractable.

UnityEvent<SelectEnterInteractionEventArgs> SelectEntered

Gets the event called when an IInteractor starts selecting an IInteractable.

UnityEvent<SelectExitInteractionEventArgs> SelectExited

Gets the event called when an IInteractor stops selecting an IInteractable.

UnityEvent<ActivateEnterInteractionEventArgs> ActivateEntered

Gets the event called when an IInteractor starts activating an IInteractable.

UnityEvent<ActivateExitInteractionEventArgs> ActivateExited

Gets the event called when an IInteractor stops activating an IInteractable.

Methods

bool RegisterInteractor(IInteractor interactor)

Registers the interactor with the manager.

Parameters:

interactor

The interactor to register.

Returns:

true if the internal registration list changes (i.e. the interactor is not already registered).

bool RegisterInteractable(IInteractable interactable)

Registers the interactable with the manager.

Parameters:

interactable

The interactable to register.

Returns:

true if the internal registration list changes (i.e. the interactable is not already registered).

void DeregisterInteractor(IInteractor interactor)

Deregisters the interactor from the manager.

Parameters:

interactor

The interactor to deregister.

void DeregisterInteractable(IInteractable interactable)

Deregisters the interactable from the manager.

Parameters:

interactable

The interactable to deregister.

void RegisterManager(IInteractionManager manager)

Registers a manager.

Usually all the IInteractionManagers are kept in a static collection, to be easily accessible. This method should be called when the manager is enabled in order to add it to this list.

Parameters:

manager

The manager.

void DeregisterManager(IInteractionManager manager)

Deregisters a manager.

Parameters:

manager

The manager to deregister.

See also:

RegisterManager(IInteractionManager)

void GetRegisteredInteractors(List<IInteractor> result)

Gets all the registered interactors with this manager.

Parameters:

result

The list to put the result. It will be cleared before adding to it.

void GetRegisteredInteractables(List<IInteractable> result)

Gets all the registered interactables with this manager.

Parameters:

result

The list to put the result. It will be cleared before adding to it.

bool IsInteractorRegistered(IInteractor interactor)

Gets if the interactor is registered with this manager.

Parameters:

interactor

The interactor to check if registered.

Returns:

true if the interactor is registered with this manager.

bool IsInteractableRegistered(IInteractable interactable)

Gets if the interactable is registered with this manager.

Parameters:

interactable

The interactable to check if registered.

Returns:

true if the interactable is registered with this manager.

bool TryGetInteractableFromCollider(
    Collider collider,
    out IInteractable interactable
)

Tries to get the IInteractable that has the given collider.

Parameters:

collider

The interactable’s collider.

interactable

The interactable, if found.

Returns:

true if an interactable with the given collider was found.

bool TryGetInteractorFromCollider(
    Collider collider,
    out IInteractor interactable
)

Tries to get the IInteractor that has the given collider.

Parameters:

collider

The interactor’s collider.

interactable

The interactor, if found.

Returns:

true if an interactor with the given collider was found.

bool HoverEnter(IInteractor interactor, IInteractable interactable)

Sends the hover enter event to the given interactable and interactor.

Parameters:

interactor

The interactor.

interactable

The interactable.

Returns:

true on success.

bool HoverExit(IInteractor interactor, IInteractable interactable)

Sends the hover exit event to the given interactable and interactor.

Parameters:

interactor

The interactor.

interactable

The interactable.

Returns:

true on success.

bool SelectEnter(IInteractor interactor, IInteractable interactable)

Sends the select enter event to the given interactable and interactor.

Parameters:

interactor

The interactor.

interactable

The interactable.

Returns:

true on success.

bool SelectExit(IInteractor interactor, IInteractable interactable)

Sends the seelct exit event to the given interactable and interactor.

Parameters:

interactor

The interactor.

interactable

The interactable.

Returns:

true on success.

bool ActivateEnter(IInteractor interactor, IInteractable interactable)

Sends the activate enter event to the given interactable and interactor.

Parameters:

interactor

The interactor.

interactable

The interactable.

Returns:

true on success.

bool ActivateExit(IInteractor interactor, IInteractable interactable)

Sends the activate exit event to the given interactable and interactor.

Parameters:

interactor

The interactor.

interactable

The interactable.

Returns:

true on success.