class MAGES::Interaction::BaseUIInteractor

Overview

A helper class to make it easier to create UI interactors. More…

class BaseUIInteractor: public MAGES::Interaction::IUIInteractor
{
public:
    // properties

    int PointerId;
    Transform Transform;
    bool AllowUIInteraction;
    bool IsPointerOverGameObject;
    UnityEvent RegisterEnter;
    UnityEvent DeregisterEnter;

    // methods

    bool RegisterToEventSystem();
    virtual void DeregisterFromEventSystem();
    virtual TrackedDeviceModel TryGetUIModel();
    virtual PointerEventData TryGetLastPointerEventData();
    void UpdateUIModel(TrackedDeviceModel model);
};

// direct descendants

class DirectUIInteractor;
class RayUIInteractor;

Inherited Members

public:
    // properties

    int PointerId;
    Transform Transform;
    bool AllowUIInteraction;
    bool IsPointerOverGameObject;
    UnityEvent RegisterEnter;
    UnityEvent DeregisterEnter;

    // methods

    TrackedDeviceModel TryGetUIModel();
    PointerEventData TryGetLastPointerEventData();
    void UpdateUIModel(TrackedDeviceModel model);
    bool RegisterToEventSystem();
    void DeregisterFromEventSystem();

Detailed Documentation

A helper class to make it easier to create UI interactors.

Properties

int PointerId

Gets the pointer ID of the interactor, if it has one. Otherwise a value smaller than 0.

Transform Transform

Gets the transform from which the Raycast/Sphere for UIs originates.

bool AllowUIInteraction

Gets or sets a value indicating whether the interactor is in a state where it can interact with UIs.

bool IsPointerOverGameObject

Gets a value indicating whether the interactor is currently hovering over a gameobject.

UnityEvent RegisterEnter

Gets or sets the event invoked when the interactor registers with an event system.

UnityEvent DeregisterEnter

Gets or sets the event invoked when the interactor deregisters from an event system.

Methods

bool RegisterToEventSystem()

Tries to register the interactor with the current event system.

Returns:

True if the interactor was successfully registered.

virtual void DeregisterFromEventSystem()

Deregisters the interactor from the current event system.

virtual TrackedDeviceModel TryGetUIModel()

Try to get the UI model for the current interactor.

Returns:

The UI Model if exists.

virtual PointerEventData TryGetLastPointerEventData()

Try to get the last pointer event data for the current interactor.

Returns:

The last pointer event data, if it exists.

void UpdateUIModel(TrackedDeviceModel model)

Updates the UI model with the current state of the interactor.

Parameters:

model

The model to fill with the current state of the IUIInteractor.