โšกInteractor

โœ”

Overview

This component stores the Index and GameObject of an Interactable and invokes events that can be used to create Reactions according to each interactable value. It also executes the Interaction logic on the Interactable.

How to use it

Place the Interactor on your character and add an Interaction Area (Collider). This will allow to detect interactables on the scene. When an Interactable is inside the Collider, then the Interaction logic can be activated.

Either the Interactor or the Interactable gameobject needs to have a Rigidbody attached. Otherwise, the Interaction will not occur.

To activate the interaction you can add an Input to your Malbers Input Component and connect it directly to the Interactor.

If the Interactable is set to be Automatic then the interaction wont need Manual activation.

Use the reactions list to have different reactions with different Interactables IDs.

Parameters

Layer

What layer will be checked on the interactables

Trigger Interaction

Does the Interactor interact with triggers or just colliders?

ID

Index of the Interactor. This parameter is received by the Interactable when Interact() is called to check who was the Interactor that activated the logic

Interaction Area

Reference for the Collider that will be used for finding interactables [On Trigger Enter]

Events

On Interact with (GameObject)

Invoked when the Interact() Method is called. Send as parameter the Interactable GameObject

On Interact with (Int)

Invoked when the Interact() Method is called. Send as parameter the Interactable Index

On Focused (GameObject)

Invoked when an Interactable enters the Interaction Area. Send as parameter the Interactable GameObject

On Unfocused (GameObject)

Invoked when an Interactable enters the Interaction Area. Send as parameter the Interactable GameObject

Reactions

Index

Check the Index of the Focused Iteractable. if is equal, Not Equal, Greater or Less than this value then Apply the Reaction.

Target

Component that the reaction will be applied to

Reaction

Reaction to apply to the target if the Index of the Focused interactable matches the Index Value

Last updated