InteractableComponent


class InteractableComponent : Component


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

Summary

Public companion functions

InteractableComponent
create(
    session: Session,
    executor: Executor,
    inputEventListener: InputEventListener
)

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-alpha02
fun create(
    session: Session,
    executor: Executor,
    inputEventListener: InputEventListener
): 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 InputEventListener.

inputEventListener: InputEventListener

InputEventListener that accepts InputEvents.

Public functions

onAttach

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

open fun onDetach(entity: Entity): Unit

Detaches this component from the given entity.

Parameters
entity: Entity

The entity to detach this component from.