32 lines
1.1 KiB
Markdown
32 lines
1.1 KiB
Markdown
# ShrinkSDK.EntJoy.Godot
|
|
|
|
Godot 4.7 C# 的 EntJoy ECS/JobSystem 生命周期适配包。它复用 EntJoy 的 `World`、查询和 Job API,不创建第二套 ECS;`ShrinkEntJoyHost` 负责在 Godot 节点生命周期内初始化/关闭 JobSystem,并在帧边界交换事件缓冲和提交待处理 Job。
|
|
|
|
## 安装
|
|
|
|
```powershell
|
|
dotnet add package ShrinkSDK.Godot --version 0.2.1
|
|
dotnet add package ShrinkSDK.EntJoy.Godot --version 0.1.1
|
|
```
|
|
|
|
该包依赖 `EntJoy.ECS` 1.0.0。EntJoy 当前 NuGet 原生运行时以 Windows x64 为主要验证目标;没有可用原生 DLL 时由 EntJoy 自己回退到托管 JobSystem。
|
|
|
|
## 使用
|
|
|
|
```csharp
|
|
using EntJoy.ECS;
|
|
using ShrinkSDK.EntJoy.Godot;
|
|
|
|
public partial class GameRoot : ShrinkEntJoyHost
|
|
{
|
|
public override void _Ready()
|
|
{
|
|
base._Ready();
|
|
EntityManager entities = EntJoyWorld!.EntityManager;
|
|
// 创建实体、构造 QueryBuilder 并调度 EntJoy Job。
|
|
}
|
|
}
|
|
```
|
|
|
|
`EntJoyWorld` 在 `_Ready` 后可用,在 `_ExitTree` 前释放。多个 `ShrinkEntJoyHost` 会共享进程级 JobSystem,并在最后一个宿主退出时关闭。
|