InteractableComponent


public final class InteractableComponent implements Component


Provides access to raw input events for given Entity, so a client can implement their own interaction logic.

Summary

Public methods

static final @NonNull InteractableComponent
create(
    @NonNull Session session,
    @NonNull Executor executor,
    @NonNull InputEventListener inputEventListener
)

Public factory for creating an InteractableComponent.

boolean

Attaches this component to the given entity.

void

Detaches this component from the given entity.

Public methods

create

Added in 1.0.0-alpha02
public static final @NonNull InteractableComponent create(
    @NonNull Session session,
    @NonNull Executor executor,
    @NonNull InputEventListener inputEventListener
)

Public factory for creating an InteractableComponent. It enables access to raw input events.

Parameters
@NonNull Session session

Session to create the InteractableComponent in.

@NonNull Executor executor

Executor for invoking InputEventListener.

@NonNull InputEventListener inputEventListener

InputEventListener that accepts InputEvents.

onAttach

public boolean onAttach(@NonNull Entity entity)

Attaches this component to the given entity.

Parameters
@NonNull Entity entity

The entity to attach this component to.

Returns
boolean

true if the component was successfully attached, false otherwise.

onDetach

public void onDetach(@NonNull Entity entity)

Detaches this component from the given entity.

Parameters
@NonNull Entity entity

The entity to detach this component from.