Skip to Content

施工中

这一篇还在编写,内容与示例随时可能变动。

查询(Query)

query 是遍历 ECS 实体的循环语句:按组件类型筛选实体,把组件字段以变量视图绑定进循环体,读写直达宿主存储。组件的声明见组件。

形态

完整语法([...] 为可选槽):

query ([ref] 名: 组件类型, ...) [with C1, C2] [without C3] [label L] { 语句... }
public func UpdateMovement(dt: float) -> void { query (ref pos: Position, vel: Velocity) with Enemy without Dead { val id = entity; pos.X += vel.X * dt; pos.Y += vel.Y * dt; Runtime.Print("entity", id, "moved to", pos.X, pos.Y); } }

编写到此Written up to here

本页其余部分尚未完成,内容随时补充。The rest of this page is not written yet; more content will follow.

最后更新于 2026年10月10日