class MAGES::Interaction::MAGESInteractionSystem

Overview

The MAGES Interaction System module. More…

class MAGESInteractionSystem: public MAGES::InteractionSystemModule
{
public:
    // classes

    class SetRaycastsEnabledStep;

    // properties

    Material DefaultHoverMaterial;
    GameObject DefaultReticle;

    // methods

    virtual override void Startup();
    virtual override void Shutdown();

    virtual override bool TryAddInteractable(
        GameObject gameObject,
        string interactableType,
        out IInteractable component
    );

    virtual override IInteractable GetInteractable(
        GameObject gameObject,
        string interactableType
    );

    virtual override IInteractable GetOrAddInteractable(
        GameObject gameObject,
        string interactableType
    );

    virtual override IInteractable AddGrabbable(GameObject gameObject);
    virtual override IInteractable GetGrabbable(GameObject gameObject);
    virtual override IInteractable GetOrAddGrabbable(GameObject gameObject);

    virtual override bool TryAddInteractor(
        GameObject gameObject,
        string interactorType,
        out IInteractor component
    );

    virtual override IInteractor GetInteractor(
        GameObject gameObject,
        string interactorType
    );

    virtual override IInteractor GetOrAddInteractor(
        GameObject gameObject,
        string interactorType
    );
};

Inherited Members

public:
    // classes

    class InteractableInfo;
    class InteractorInfo;

    // properties

    GameObject LeftHand;
    GameObject RightHand;
    GameObject Avatar;
    List<InteractableInfo> Interactables;
    List<InteractorInfo> Interactors;
    bool AutomaticPlayerRigSetup;

    // methods

    virtual abstract void Startup() = 0;
    virtual abstract void Shutdown() = 0;

    virtual bool TryAddInteractable(
        GameObject gameObject,
        string interactableType,
        out IInteractable component
    );

    virtual IInteractable GetInteractable(
        GameObject gameObject,
        string interactableType
    );

    virtual IInteractable GetOrAddInteractable(
        GameObject gameObject,
        string interactableType
    );

    virtual IInteractable AddGrabbable(GameObject gameObject);
    virtual IInteractable GetGrabbable(GameObject gameObject);
    virtual IInteractable GetOrAddGrabbable(GameObject gameObject);

    virtual bool TryAddInteractor(
        GameObject gameObject,
        string interactorType,
        out IInteractor component
    );

    virtual IInteractor GetInteractor(GameObject gameObject, string interactorType);

    virtual IInteractor GetOrAddInteractor(
        GameObject gameObject,
        string interactorType
    );

Detailed Documentation

The MAGES Interaction System module.

Properties

Material DefaultHoverMaterial

Gets the default hover material to be used for hovered interactables.

GameObject DefaultReticle

Gets the default reticle to use when hovering over interactables that do not provide their own.

Methods

virtual override void Startup()

Called when the module is started (usually on application start).

virtual override void Shutdown()

Called when the module is destroyed or replaced.

virtual override bool TryAddInteractable(
    GameObject gameObject,
    string interactableType,
    out IInteractable component
)

Tries to add the given interactableType script to the gameObject.

Parameters:

gameObject

The gameobject to add the interactable to.

interactableType

The identifier name of the interactable type. See the scriptable object for all available types.

component

The IInteractable component added.

Returns:

true if it was possible to find the given interactableType type and add it to the gameObject.

See also:

GetOrAddInteractable(GameObject, string)

virtual override IInteractable GetInteractable(
    GameObject gameObject,
    string interactableType
)

Gets the interactable of the given interactableType from the gameObject.

Parameters:

gameObject

The gameobject to get the component from.

interactableType

The type of the interactable to get.

Returns:

The interactable if found as IInteractable or null if it does not exist.

virtual override IInteractable GetOrAddInteractable(
    GameObject gameObject,
    string interactableType
)

Gets the interactable of the given interactableType from the gameObject. If the gameObject does not have this interactable type script, it will be added.

Parameters:

gameObject

The gameobject to get the component from or add it to.

interactableType

The type of the interactable to get or add.

Returns:

The interactable if found or added as IInteractable, or null if the interactableType given is invalid.

See also:

GetInteractable(GameObject, string), GetOrAddGrabbable(GameObject), TryAddInteractable(GameObject, string, out IInteractable)

virtual override IInteractable AddGrabbable(GameObject gameObject)

Adds a Grabbable to the gameObject.

Parameters:

gameObject

The GameObject in which to add the Grabbable component.

Returns:

The added grabbable component.

virtual override IInteractable GetGrabbable(GameObject gameObject)

Gets the Grabbable from the gameObject.

Parameters:

gameObject

The GameObject to get the Grabbable from.

Returns:

The grabbable if found, else null.

virtual override IInteractable GetOrAddGrabbable(GameObject gameObject)

Adds a Grabbable to the gameObject or gets the one already on it.

This is the same as doing it with GetOrAddInteractable(GameObject, string), but is added extra to eliminate typo errors when using strings.

Parameters:

gameObject

The GameObject in which to add the Grabbable component.

Returns:

The Grabbable added or found, as IInteractable.

virtual override bool TryAddInteractor(
    GameObject gameObject,
    string interactorType,
    out IInteractor component
)

Tries to add the given interactorType script to the gameObject.

Parameters:

gameObject

The gameobject to add the interactor to.

interactorType

The identifier name of the interactor type. See the scriptable object for all available types.

component

The IInteractor component added.

Returns:

true if it was possible to find the given interactorType type and add it to the gameObject.

See also:

GetOrAddInteractor(GameObject, string)

virtual override IInteractor GetInteractor(
    GameObject gameObject,
    string interactorType
)

Gets the interactor of the given interactorType from the gameObject.

Parameters:

gameObject

The gameobject to get the component from.

interactorType

The type of the interactor to get.

Returns:

The interactor if found as IInteractor or null if it does not exist.

See also:

GetOrAddInteractor(GameObject, string), TryAddInteractor(GameObject, string, out IInteractor)

virtual override IInteractor GetOrAddInteractor(
    GameObject gameObject,
    string interactorType
)

Gets the interactor of the given interactorType from the gameObject. If the gameObject does not have this interactor type script, it will be added.

/>

Parameters:

gameObject

The gameobject to get the component from or add it to.

interactorType

The type of the interactor to get or add.

Returns:

The interactor if found or added as IInteractor, or null if the interactorType given is invalid.

See also:

GetInteractor(GameObject, string), TryAddInteractor(GameObject, string, out IInteractor)