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