* 转换为数组 * * Convert to array. * * @returns 实体和组件元组数组 | Array of entity and components tuples
()
| 260 | * @returns 实体和组件元组数组 | Array of entity and components tuples |
| 261 | */ |
| 262 | public toArray(): Array<[Entity, ...InstanceTypes<T>]> { |
| 263 | const result: Array<[Entity, ...InstanceTypes<T>]> = []; |
| 264 | |
| 265 | this.forEach((entity, ...components) => { |
| 266 | result.push([entity, ...components]); |
| 267 | }); |
| 268 | |
| 269 | return result; |
| 270 | } |
| 271 | |
| 272 | /** |
| 273 | * 映射转换 |