InteractableComponent


class InteractableComponent : Component


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

Summary

Public companion functions

InteractableComponent
create(session: Session, inputEventListener: Consumer<InputEvent>)

Public factory for creating an InteractableComponent.

InteractableComponent
create(
    session: Session,
    executor: Executor,
    inputEventListener: Consumer<InputEvent>
)

Public factory for creating an InteractableComponent.

Public functions

open Boolean
onAttach(entity: Entity)

Attaches this component to the given Entity.

open Unit
onDetach(entity: Entity)

Detaches this component from the given Entity.

Public companion functions

create

Added in 1.0.0-alpha05
fun create(session: Session, inputEventListener: Consumer<InputEvent>): InteractableComponent

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

Parameters
session: Session

Session to create the InteractableComponent in.

inputEventListener: Consumer<InputEvent>

Consumer that accepts InputEvents. The listener callbacks will be invoked on the main thread.

create

Added in 1.0.0-alpha05
fun create(
    session: Session,
    executor: Executor,
    inputEventListener: Consumer<InputEvent>
): InteractableComponent

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

Parameters
session: Session

Session to create the InteractableComponent in.

executor: Executor

Executor for invoking the inputEventListener.

inputEventListener: Consumer<InputEvent>

Consumer that accepts InputEvents.

Public functions

onAttach

Added in 1.0.0-alpha05
open fun onAttach(entity: Entity): Boolean

Attaches this component to the given Entity.

Parameters
entity: Entity

The Entity to attach this component to.

Returns
Boolean

true if the component was successfully attached, false otherwise.

onDetach

Added in 1.0.0-alpha05
open fun onDetach(entity: Entity): Unit

Detaches this component from the given Entity.

Parameters
entity: Entity

The Entity to detach this component from.