Hierarchy
_Query
↳ Query
#
Constructors#
constructor+ new Query(predicate
: QueryPredicate): Query
Initializes Query instance
#
Parameters:Name | Type | Description |
---|---|---|
predicate | QueryPredicate | Matching 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:Name | Type |
---|---|
predicate | QueryPredicate |
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:Name | Type | Description |
---|---|---|
predicate | QueryPredicate | function 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:Name | Type | Description |
---|---|---|
predicate | QueryPredicate | function 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:Name | Type |
---|---|
entity | Entity |
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:Name | Type |
---|---|
T | Constructor<{}>[] |
K | readonly [T, K] |
#
Parameters:Name | Type |
---|---|
types | K |
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:Name | Type |
---|---|
entities | readonly 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:Name | Type |
---|---|
T | any[] |
K | readonly [T, K] |
#
Parameters:Name | Type |
---|---|
types | K |
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:Name | Type |
---|---|
T | Constructor<{}>[] |
K | readonly [T, K] |
#
Parameters:Name | Type |
---|---|
types | K |
cb | (entity : Entity, instances : Instances<T, K>, index? : number) => void |
Returns: void
Defined in: libs/core/src/lib/Query.ts:31