* 根据句柄查找实体 * * 通过轻量级句柄查找对应的实体(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)
| 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 | * 根据标签查找实体 |
nothing calls this directly
no test coverage detected