MCPcopy Create free account
hub / github.com/esengine/esengine / queryNone

Method queryNone

packages/core/src/ECS/Core/QuerySystem.ts:420–439  ·  view source on GitHub ↗

* 查询不包含任何指定组件的实体 * * 返回不包含任何指定组件类型的实体列表。 * 内部使用响应式查询作为智能缓存,自动跟踪实体变化,性能更优。 * * @param componentTypes 要排除的组件类型列表 * @returns 查询结果,包含匹配的实体和性能信息 * * @example * ```typescript * // 查询不具有AI和玩家控制组件的实体(如静态物体) * const result = querySystem.queryNone(AICompo

(...componentTypes: ComponentType[])

Source from the content-addressed store, hash-verified

418 * ```
419 */
420 public queryNone(...componentTypes: ComponentType[]): QueryResult {
421 const startTime = performance.now();
422 this._queryStats.totalQueries++;
423
424 // 使用内部响应式查询作为智能缓存
425 const reactiveQuery = this.getOrCreateReactiveQuery(QueryConditionType.NONE, componentTypes);
426
427 // 从响应式查询获取结果(永远是最新的)
428 const entities = reactiveQuery.getEntities();
429
430 // 统计为缓存命中(响应式查询本质上是永不过期的智能缓存)
431 this._queryStats.cacheHits++;
432
433 return {
434 entities,
435 count: entities.length,
436 executionTime: performance.now() - startTime,
437 fromCache: true
438 };
439 }
440
441 /**
442 * 按标签查询实体

Callers 2

executeMethod · 0.45

Calls 3

nowMethod · 0.80
getEntitiesMethod · 0.65

Tested by

no test coverage detected