ArchetypeResolver: {
    add: ((source, toAdd) => Archetype);
    contains: ((container, contained) => boolean);
    get: ((component) => Archetype);
    getAll: ((components) => Archetype);
    getEmpty: (() => Archetype);
    intersects: ((archetypeA, archetypeB) => boolean);
    merge: ((masks) => Archetype);
    remove: ((source, toRemove) => Archetype);
}

Interface for managing and manipulating archetypes.

Type declaration

  • add: ((source, toAdd) => Archetype)
      • (source, toAdd): Archetype
      • Returns the sum of two archetypes.

        Parameters

        • source: Archetype

          The original archetype.

        • toAdd: Archetype

          The archetype to add to the source.

        Returns Archetype

        A new archetype that is the sum of both input archetypes.

  • contains: ((container, contained) => boolean)
      • (container, contained): boolean
      • Checks if an archetype contains another.

        Parameters

        • container: Archetype

          The archetype that might contain another.

        • contained: Archetype

          The archetype to check for containment.

        Returns boolean

        True if the container archetype contains the contained archetype, otherwise false.

  • get: ((component) => Archetype)
      • (component): Archetype
      • Gets the archetype for a single component type.

        Parameters

        • component: Component

          The component for which to get the archetype.

        Returns Archetype

        The archetype corresponding to the given component.

  • getAll: ((components) => Archetype)
      • (components): Archetype
      • Gets the merged archetype for a list of component types.

        Parameters

        • components: Component[]

          An array of components for which to get the merged archetype.

        Returns Archetype

        The archetype that combines all the given components.

  • getEmpty: (() => Archetype)
  • intersects: ((archetypeA, archetypeB) => boolean)
      • (archetypeA, archetypeB): boolean
      • Checks if two archetypes overlap.

        Parameters

        Returns boolean

        True if the archetypes overlap, otherwise false.

  • merge: ((masks) => Archetype)
      • (masks): Archetype
      • Merges multiple archetypes into a single archetype.

        Parameters

        • masks: Archetype[]

          An array of archetypes to merge.

        Returns Archetype

        A new archetype that combines all input archetypes.

  • remove: ((source, toRemove) => Archetype)
      • (source, toRemove): Archetype
      • Removes a component type from an existing archetype.

        Parameters

        • source: Archetype

          The original archetype.

        • toRemove: Archetype

          The archetype to remove from the source.

        Returns Archetype

        A new archetype with the component removed.