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

Method findEntityByHandle

packages/core/src/ECS/Scene.ts:883–889  ·  view source on GitHub ↗

* 根据句柄查找实体 * * 通过轻量级句柄查找对应的实体(O(1) 时间复杂度)。 * 如果句柄无效或实体已被销毁,返回 null。 * * Find entity by handle (O(1) time complexity). * Returns null if handle is invalid or entity has been destroyed. * * @param handle 实体句柄 | Entity handle * @returns 实体实例或 null | Entity i

(handle: EntityHandle)

Source from the content-addressed store, hash-verified

881 * @returns 实体实例或 null | Entity instance or null
882 */
883 public findEntityByHandle(handle: EntityHandle): Entity | null {
884 if (!isValidHandle(handle) || !this.handleManager.isAlive(handle)) {
885 return null;
886 }
887
888 return this._handleToEntity.get(handle) ?? null;
889 }
890
891 /**
892 * 根据标签查找实体

Callers

nothing calls this directly

Calls 3

isValidHandleFunction · 0.90
isAliveMethod · 0.80
getMethod · 0.65

Tested by

no test coverage detected