Includes core gameplay, 600 exported levels, visual assets, web bridge, and bootstrap scene. Co-authored-by: Cursor <cursoragent@cursor.com>
31 lines
983 B
Markdown
31 lines
983 B
Markdown
# Unity 关卡迁移到 Cocos
|
||
|
||
Unity 原项目约 1.1 万个 `Level*.prefab`,Cocos 版使用 **JSON/TS 配置** 代替 Tilemap Prefab。
|
||
|
||
## 配置格式
|
||
|
||
```typescript
|
||
registerLevel({
|
||
levelID: 601,
|
||
boundary: { x: 20, y: 20 },
|
||
border: { "10,0": true, ... }, // 可选
|
||
ground: { "0,0": "Baseblock", "1,0": "JumpBlock" }, // 可选
|
||
spawns: [
|
||
{ x: 0, y: 0, kind: 'player', playerDirection: 0 },
|
||
{ x: 3, y: 0, kind: 'prop' },
|
||
],
|
||
});
|
||
```
|
||
|
||
## 批量迁移步骤
|
||
|
||
1. 从 `Assets/Scripts/Core/Levels*.cs` 提取 `LevelID`、`spawns`、`boundary`
|
||
2. 若有 Tiled 导出或 Tilemap 脚本,生成 `ground` / `border` 稀疏表
|
||
3. 写入 `assets/scripts/level/LevelRegistry.ts` 或独立 `assets/resources/levels/{id}.json`
|
||
4. 在 `LevelRegistry.ts` 的 `getLevelConfig` 中合并 JSON 加载
|
||
|
||
## 资源迁移
|
||
|
||
- 角色/载具贴图:放入 `assets/resources/textures/`,替换 `GameManager.attachVisual` 为 Sprite 渲染
|
||
- 音频:放入 `assets/resources/audio/`
|