Skip to main content

Hierarchy

  • _Query

    Query

Constructors#

constructor#

+ new Query(predicate: QueryPredicate): Query

Initializes Query instance

Parameters:#

NameTypeDescription
predicateQueryPredicateMatching predicate

Returns: Query

Inherited from: _Query.constructor

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:25

Properties#

onEntityAdded#

onEntityAdded: Signal<(snapshot: EntitySnapshot) => void>

Signal dispatches if new matched entity were added

Inherited from: _Query.onEntityAdded

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:17


onEntityRemoved#

onEntityRemoved: Signal<(snapshot: EntitySnapshot) => void>

Signal dispatches if entity stops matching query

Inherited from: _Query.onEntityRemoved

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:21

Accessors#

entities#

• get entities(): readonly Entity[]

Entities list which matches the query

Returns: readonly Entity[]

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:34


first#

• get first(): Entity

Returns the first entity in the query or undefined if query is empty.

Returns: Entity

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:39


isEmpty#

• get isEmpty(): boolean

Gets a value indicating that query is empty

Returns: boolean

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:86


last#

• get last(): Entity

Returns the last entity in the query or undefined if query is empty.

Returns: Entity

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:44


length#

• get length(): number

Returns the number of the entities in the query

Returns: number

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:49

Methods#

clear#

clear(): void

Clears the list of entities of the query

Returns: void

Inherited from: _Query.clear

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:90


countBy#

countBy(predicate: QueryPredicate): number

Returns the number of entities that have been tested by the predicate.

Parameters:#

NameType
predicateQueryPredicate

Returns: number

Inherited from: _Query.countBy

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:55


filter#

filter(predicate: QueryPredicate): Entity[]

Returns new array of entities, which passed testing via predicate

Parameters:#

NameTypeDescription
predicateQueryPredicatefunction that will be called for every entity in the query. If function returns true - entity will stay in the array, if false than it will be removed.

Returns: Entity[]

Inherited from: _Query.filter

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:69


find#

find(predicate: QueryPredicate): Entity

Returns the first entity from the query, that was accepted by predicate

Parameters:#

NameTypeDescription
predicateQueryPredicatefunction that will be called for every entity in the query until the result of the function become true.

Returns: Entity

Inherited from: _Query.find

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:62


has#

has(entity: Entity): boolean

Returns a value that indicates whether the entity is in the Query.

Parameters:#

NameType
entityEntity

Returns: boolean

Inherited from: _Query.has

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:75


loop#

loop<T, K>(types: K, cb: (entity: Entity, instances: Instances<T, K>, index?: number) => void): void

Type parameters:#

NameType
TConstructor<{}>[]
Kreadonly [T, K]

Parameters:#

NameType
typesK
cb(entity: Entity, instances: Instances<T, K>, index?: number) => void

Returns: void

Defined in: libs/core/src/lib/Query.ts:16


matchEntities#

matchEntities(entities: readonly Entity[]): void

This method is matching passed list of entities with predicate of the query to determine if entities are the part of query or not.

Entities that will pass testing will become a part of the query

Parameters:#

NameType
entitiesreadonly Entity[]

Returns: void

Inherited from: _Query.matchEntities

Defined in: libs/core/node_modules/tick-knock/lib/ecs/Query.d.ts:82


mloop#

mloop<T, K>(types: K, cb: (entity: Entity, instances: Instances<T, K>, index?: number) => void): void

Type parameters:#

NameType
Tany[]
Kreadonly [T, K]

Parameters:#

NameType
typesK
cb(entity: Entity, instances: Instances<T, K>, index?: number) => void

Returns: void

Defined in: libs/core/src/lib/Query.ts:46


rloop#

rloop<T, K>(types: K, cb: (entity: Entity, instances: Instances<T, K>, index?: number) => void): void

Type parameters:#

NameType
TConstructor<{}>[]
Kreadonly [T, K]

Parameters:#

NameType
typesK
cb(entity: Entity, instances: Instances<T, K>, index?: number) => void

Returns: void

Defined in: libs/core/src/lib/Query.ts:31