Files
cocos/tools/unity-level-export.md
刘宇飞 cba5105908 Initial Cocos Creator port of main-site Unity WebGL game.
Includes core gameplay, 600 exported levels, visual assets, web bridge, and bootstrap scene.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-22 14:57:46 +08:00

31 lines
983 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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/`