Options
All
  • Public
  • Public/Protected
  • All
Menu

Watch groups are standalone classes that group multiple watched values. A watch group must be scheduled as a system in order to trigger delegates/callbacks.

Callbacks have the same restrictions as code running in systems. They are called from the watching system, just like code called from any other system. They are executed when the watching system runs, and not immediately when a value changes.

Hierarchy

Index

Methods

createSystem

  • Creates a new system that references this watch group. A watch group can be scheduled as multiple systems, which enables advanced ordering of the watching system. You should use either Schedule or CreateSystem, not both. If you use both the watching system is scheduled twice, and every callback is called twice.

    Returns SystemBase

name

  • name(): string
  • Gets the name of this watch group

    Returns string

removeAllWatchers

  • Removes all watchers that watch the component type cid

    Parameters

    Returns void

removeWatcher

  • removeWatcher(id: number): void
  • Removes a watcher with a specific id. Ids are returned by the various Watch* functions.

    Parameters

    • id: number

    Returns void

schedule

  • Shortcut for creating a system and scheduling it using s.schedule(this.CreateSystem()); You should use either Schedule or CreateSystem, not both. If you use both the watching system is scheduled twice, and every callback is called twice.

    Parameters

    Returns void

setName

  • setName(name: string): void
  • Sets a name for this watch group

    Parameters

    • name: string

    Returns void

unSchedule

  • Shortcut for removing the system scheduled with Schedule.

    Parameters

    Returns void

watchAdded

  • Watches entity e for the addition of component type cid. When the specified component is added, callback f is called. Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchAddedMask

  • Watches all entities that match mask for the addition of component type cid. When the component is added, callback f is called for each entity that it was added to. Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchChangedBool

  • Watches entity e for changes to a bool at offset, on a component with id cid. When the value is changed, f is called. Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchChangedBoolMask

  • Watches all entities that match mask for changes to a bool at offset, on component cid. When the value is changed, f is called for each individual entity Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchChangedFloat

  • Watches entity e for changes to a float at offset, on a component with id cid. When the value is changed, f is called. Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchChangedFloatMask

  • Watches all entities that match mask for changes to a float at offset, on component cid. When the value is changed, f is called for each individual entity Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchChangedInt

  • Watches entity e for changes to an int at offset, on a component with id cid. When the value is changed, f is called. Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchChangedIntMask

  • Watches all entities that match mask for changes to an int at offset, on component cid. When the value is changed, f is called for each individual entity Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchRemoved

  • Watches entity e for the removal of component type cid. When the component is removed, callback f is called. Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

watchRemovedMask

  • Watches all entities that match mask for the removal of component type cid. When the component is removed, the callback f is called for each entity that it was removed from. Returns an id for the watcher that can be used in RemoveWatcher.

    Note that all watching callbacks are called when the watching system runs, not when the value is changed.

    Parameters

    Returns number

Generated using TypeDoc