class MAGES::Interaction::InteractionManager¶
Overview¶
The InteractionManager is responsible for managing the interaction between interactable objects and interactors. Many of the methods in IInteractable and IInteractor are called from here. More…
class InteractionManager: public MonoBehaviour, public MAGES::IInteractionManager { public: // properties HashSet<IInteractionManager> Managers; UnityEvent<IInteractionManager> RegisterManagerEnter; UnityEvent<IInteractionManager> 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 void RegisterManager(IInteractionManager manager); void DeregisterManager(IInteractionManager manager); bool RegisterInteractable(IInteractable interactable); void DeregisterInteractable(IInteractable interactable); bool RegisterInteractor(IInteractor interactor); void DeregisterInteractor(IInteractor interactor); void GetRegisteredInteractors(List<IInteractor> result); void GetRegisteredInteractables(List<IInteractable> result); bool IsInteractorRegistered(IInteractor interactor); bool IsInteractableRegistered(IInteractable interactable); bool TryGetInteractorFromCollider(Collider collider, out IInteractor interactor); bool TryGetInteractableFromCollider( Collider collider, out IInteractable 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); };
Inherited Members¶
public: // properties UnityEvent<IInteractionManager> RegisterManagerEnter; UnityEvent<IInteractionManager> 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);
Detailed Documentation¶
The InteractionManager is responsible for managing the interaction between interactable objects and interactors. Many of the methods in IInteractable and IInteractor are called from here.
Properties¶
HashSet<IInteractionManager> Managers
Gets all the active interaction managers.
UnityEvent<IInteractionManager> RegisterManagerEnter
Gets the event called when a manager is registered.
UnityEvent<IInteractionManager> 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¶
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)
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 DeregisterInteractable(IInteractable interactable)
Deregisters the interactable from the manager.
Parameters:
interactable |
The interactable to deregister. |
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).
void DeregisterInteractor(IInteractor interactor)
Deregisters the interactor from the manager.
Parameters:
interactor |
The interactor to deregister. |
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 TryGetInteractorFromCollider(Collider collider, out IInteractor interactor)
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 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 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.