Class GameSystem

A base class for all game systems. A game system is a class that updates the state of the game world on each frame.

Hierarchy

Constructors

  • Creates a new instance of the GameSystem class.

    Parameters

    • world: World<Entity>

      The World instance that this system will be added to.

    • Optional attributes: Attributes

      Optional attributes to configure this system.

    Returns GameSystem

Properties

config?: SystemConfig

Mutable reference to the optional SystemConfig component associated with this system.

queries: SystemQueries

Defines what GameComponent the System will query for. This needs to be user defined.

systemConfig?: GameComponentConstructor<SystemConfig>

An optional SystemConfig class for configuring this system.

Accessors

Methods

  • This function is called on the frames in which the app exits immersive

    Returns void

  • This function is called on the frames in which the app enters immersive

    Returns void

  • Get a list of all GameObject of the given queryId that are added in this frame in queries. This does not include the GameObjects that gets added in GameSystems that execute after this system.

    Returns

    An array of GameObject instances that were added in this frame and match the query.

    Throws

    An error if the query ID does not exist in the current game system or if the query does not listen to added events.

    Parameters

    • queryId: string

      The ID of the query to retrieve added game objects for.

    Returns GameObject<Object3DEventMap>[]

  • Get a list of all GameObject of the given queryId in queries.

    Returns

    An array of GameObject instances that match the query.

    Throws

    An error if the query ID does not exist in the current game system.

    Parameters

    • queryId: string

      The ID of the query to retrieve game objects for.

    Returns GameObject<Object3DEventMap>[]

  • Get a list of all GameObject of the given queryId that are removed in this frame in queries. This does not include the GameObjects that gets removed in GameSystems that execute after this system.

    Returns

    An array of GameObject instances that were removed in this frame and match the query.

    Throws

    An error if the query ID does not exist in the current game system or if the query does not listen to removed events.

    Parameters

    • queryId: string

      The ID of the query to retrieve removed game objects for.

    Returns GameObject<Object3DEventMap>[]

  • This function is called on each frame Core is executed. All of the queries defined on the class are available here.

    Parameters

    • _delta: number
    • _time: number

    Returns void