Plays a sound

volume_up

Hierarchy

Accessors

Constructors

Methods

Properties - Audio

Properties - Behavior

Properties - Other

Accessors

  • get disposed(): boolean
  • Gets the disposed status of the entity.

    Returns boolean

    The disposed status.

Constructors

Methods

  • Get the instance of the ZComponent that constructed this entity.

    If you pass the class of a ZComponent as the type parameter, this function will ensure that it returns an instance of that ZComponent. If this component or behavior was constructed by a different ZComponent class, or by a different entity altogether, the function with throw an error.

    Type Parameters

    • T extends ZComponent<any, T> = ZComponent<any>

    Parameters

    • Optionaltype: ConstructorForComponent<T>

      The ZComponent class that you are expecting to receive

    Returns T

    The instance of the ZComponent that constructed this component or behavior

  • Register a function to be called when an Event is fired, or an Observable's value changes. The function will only be bound to the underlying Event or Observable while this entity is enabled.

    Using this function, rather than attaching your handler directly to the Event or Observable, ensures your handler is automatically released when this entity is disposed.

    Type Parameters

    • Args extends any[]

    Parameters

    • evt: Event<Args>

      The Event or Observable to listen to

    • fn: ((...args: Args) => void)

      A function that will be called when the event fires, or the Observable value changes

        • (...args): void
        • Parameters

          Returns void

    • Optionalpriority: number

    Returns any

  • Type Parameters

    • Args extends any[]

    Parameters

    Returns any

  • Type Parameters

    • Type

    Parameters

    • observable: Observable<Type, never>
    • fn: ((v: Type) => void)
        • (v): void
        • Parameters

          Returns void

    • Optionalpriority: number

    Returns any

  • Type Parameters

    • Type

    Parameters

    Returns any

  • Unregisters a function that was previously registered to an Event or Observable.

    Type Parameters

    • Args extends any[]

    Parameters

    • evt: Event<Args>

      The Event or Observable

    • fn: ((...args: Args) => void)

      The function that was passed in the call to register

        • (...args): void
        • Parameters

          Returns void

    Returns any

  • Type Parameters

    • Type

    Parameters

    • observable: Observable<Type, never>
    • fn: ((v: Type) => void)
        • (v): void
        • Parameters

          Returns void

    Returns any

Properties - Audio

muted: Observable<boolean, never>

false

20

speed: Observable<number, never> = ...

20

1

volume: Observable<number, never>

proportion

20

1

Properties - Behavior

enabled: Observable<boolean, never> = ...

If false, this entity and its children will no longer participate in the experience.

Note - to read this value, you may wish to use enabledResolved which will be false if this entity, or any of its parents, have enabled set to false.

The precise implications of enabled being false will vary between entities, but in general disabled entities:

  • should not emit any events,
  • should not take any action, e.g. navigate the user to a different page,
  • should not perform any network communication,
  • should not make changes to other behaviors or components in the experience,
  • should minimise any runtime performance cost (e.g. detach from any frame handlers).

true

10

Properties - Other

contextManager: ContextManager

The current ContextManager

enabledResolved: Observable<boolean, never> = ...

This will have value false if this entity, or any of its parents, have enabled set to false.

To change the enabled status of this entity, use the enabled property instead.

The precise implications of enabled being false will vary between entities, but in general disabled entities:

  • should not emit any events,
  • should not take any action, e.g. navigate the user to a different page,
  • should not perform any network communication,
  • should not make changes to other behaviors or components in the experience,
  • should minimise any runtime performance cost.

Disabled entities will typically remain visible (if they have a visible appearance).

instance: Component<any, ConstructorProps>

The instance of the component that this behavior is attached to

onDispose: Event<[]> = ...

An event that is fired as the last act of this entity being destroyed.