diff --git a/Assets/Prefabs/第一章/人类士兵.prefab b/Assets/Prefabs/第一章/人类士兵.prefab index 1369048..6ae9f8a 100644 --- a/Assets/Prefabs/第一章/人类士兵.prefab +++ b/Assets/Prefabs/第一章/人类士兵.prefab @@ -399,7 +399,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u4EBA\u7C7B\u58EB\u5175Data" level: 1 speed: 5 detectionRange: 15 diff --git a/Assets/Prefabs/第一章/小怪/城堡金盾卫.prefab b/Assets/Prefabs/第一章/小怪/城堡金盾卫.prefab index a03e0ae..8f646d1 100644 --- a/Assets/Prefabs/第一章/小怪/城堡金盾卫.prefab +++ b/Assets/Prefabs/第一章/小怪/城堡金盾卫.prefab @@ -452,6 +452,7 @@ MonoBehaviour: summonerMode: 0 returnToAnchorWhenIdle: 0 anchorArrivalDistance: 0.35 + useAnchorLeash: 0 target: {fileID: 0} --- !u!4 &6905509304330285822 stripped Transform: diff --git a/Assets/Prefabs/第一章/弓箭手.prefab b/Assets/Prefabs/第一章/弓箭手.prefab index 2fc9c4f..6d9a66f 100644 --- a/Assets/Prefabs/第一章/弓箭手.prefab +++ b/Assets/Prefabs/第一章/弓箭手.prefab @@ -360,7 +360,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u5F13\u7BAD\u624BData" level: 1 speed: 5 detectionRange: 20 diff --git a/Assets/Prefabs/第一章/法师.prefab b/Assets/Prefabs/第一章/法师.prefab index 87c9d39..7750534 100644 --- a/Assets/Prefabs/第一章/法师.prefab +++ b/Assets/Prefabs/第一章/法师.prefab @@ -415,7 +415,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u6CD5\u5E08Data" level: 1 speed: 5 detectionRange: 20 diff --git a/Assets/Prefabs/第一章/盾卫.prefab b/Assets/Prefabs/第一章/盾卫.prefab index 4432e13..70c95c7 100644 --- a/Assets/Prefabs/第一章/盾卫.prefab +++ b/Assets/Prefabs/第一章/盾卫.prefab @@ -357,12 +357,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u76FE\u536BData" level: 1 speed: 5 detectionRange: 15 - attackRange: 1.5 - modelFacingOffset: 90 + attackRange: 2 + modelFacingOffset: 45 attackPower: 10 attackDuration: 0 attackType: 0 diff --git a/Assets/Prefabs/第一章/精锐士兵.prefab b/Assets/Prefabs/第一章/精锐士兵.prefab index 43e9da2..4da5a1b 100644 --- a/Assets/Prefabs/第一章/精锐士兵.prefab +++ b/Assets/Prefabs/第一章/精锐士兵.prefab @@ -343,7 +343,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u7CBE\u9510\u58EB\u5175Data" level: 1 speed: 5 detectionRange: 15 diff --git a/Assets/Prefabs/第二章/弓箭猎人.prefab b/Assets/Prefabs/第二章/弓箭猎人.prefab index 0ab3646..a93cfb8 100644 --- a/Assets/Prefabs/第二章/弓箭猎人.prefab +++ b/Assets/Prefabs/第二章/弓箭猎人.prefab @@ -445,7 +445,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u5F13\u7BAD\u730E\u4EBAData" level: 1 speed: 5 detectionRange: 20 diff --git a/Assets/Prefabs/第二章/狼人.prefab b/Assets/Prefabs/第二章/狼人.prefab index 7e0b750..de2a836 100644 --- a/Assets/Prefabs/第二章/狼人.prefab +++ b/Assets/Prefabs/第二章/狼人.prefab @@ -255,7 +255,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u72C2\u66B4\u72FC\u4EBAData" level: 1 speed: 5 detectionRange: 15 diff --git a/Assets/Prefabs/第二章/石巨人.prefab b/Assets/Prefabs/第二章/石巨人.prefab index f393cd8..e5ba20b 100644 --- a/Assets/Prefabs/第二章/石巨人.prefab +++ b/Assets/Prefabs/第二章/石巨人.prefab @@ -265,7 +265,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u77F3\u5DE8\u4EBAData" level: 1 speed: 5 detectionRange: 15 diff --git a/Assets/Prefabs/第二章/蓝色怪物.prefab b/Assets/Prefabs/第二章/蓝色怪物.prefab index c7c371e..cc7d304 100644 --- a/Assets/Prefabs/第二章/蓝色怪物.prefab +++ b/Assets/Prefabs/第二章/蓝色怪物.prefab @@ -244,7 +244,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: da330bbd52e2a424dbe6231c018a3c60, type: 3} m_Name: m_EditorClassIdentifier: - characterDataName: + characterDataName: "\u84DD\u8272\u602A\u7269Data" level: 1 speed: 5 detectionRange: 15 diff --git a/Assets/Scenes/DefenseTest.scene b/Assets/Scenes/DefenseTest.scene index bef127c..0a6367e 100644 Binary files a/Assets/Scenes/DefenseTest.scene and b/Assets/Scenes/DefenseTest.scene differ diff --git a/CODELY.md b/CODELY.md index 4465f72..85dcacc 100644 --- a/CODELY.md +++ b/CODELY.md @@ -131,6 +131,10 @@ - [2026-10-04 11:15:47] 2026-10-04 DefenseTest 布阵区域改为 4×4 并与用户新建的 Plane 完全重合。DeployGrid 常量:Cols=4、Rows=4、ColStep=2.875、RowStep=2.8、BackZ=-14.2、CellWidth=2.815、CellDepth=2.74、GridY=0.115、UnitY=0.10(对齐重烘后的 NavMesh)。Plane 原在 y=0.5 会挡住单位,已降到 y=0.09 并放入 Buildings 层(layer 8)排除烘焙;NavMeshSurface 体积改为 center=(0,1,12) size=(28,12,62) 重烘,NavMesh 高度由 0.16 变 0.095,DefenseWaveLevelController.spawnY 同步改为 0.1。开始游戏按钮改为顶部居中(anchor 上中、anchoredPosition y=-170、420×120)。注意:BattlePlatform 实际只覆盖 Z -22.8..17.2,所以 NavMesh 远端也就到 ~16.9,敌人 spawnZ=20 本身在地面之外(靠 NavMeshAgent 自动吸附),这是既有行为。 - [2026-10-04 13:12:11] 2026-10-04 英雄打完归位改为"走回去"(正常速度),去掉瞬移。关键坑:UnitBase.Start 里 `navAgent.stoppingDistance = attackRange*0.95` 会让 agent 在到达锚点前就认为"已到达"而停住(法师 5.7 米、盾卫 0.95 米都远大于 anchorArrivalDistance 0.35),所以"走回锚点"以前根本走不到——这正是当初只能瞬移的原因。修法:ReturnToAnchor 里把 stoppingDistance 设 0,RestoreIdleSpeed/move() 里恢复 NormalStoppingDistance。另新增 useAnchorLeash/anchorLeashDistance(英雄设为 10 米,DefenseGameFlowController.heroLeashDistance 控制),目标距锚点超过上限就不追,避免一路推到 Z≈16。DefenseGameFlowController.ResetHeroPositions 现在只清 target 让 UnitBase 自己走回,仅当 NavMesh.SamplePosition 找不到落脚点(真卡住)才瞬移兜底。 - [2026-10-04 14:12:16] 2026-10-04 DefenseTest 两处修正:1) 阵位守护距离不再单开字段,直接用 UnitBase.detectionRange(已删除 anchorLeashDistance / heroLeashDistance;DefenseGameFlowController 只留开关 heroGuardPost=true,新 bool 字段在旧场景里会反序列化成 false,必须显式写进场景)。出战 5 个英雄 Prefab 的 detectionRange 已从 30/50 调到 10(弓箭手 12)。2) 底部英雄卡的角色改回从 PlayerData.json 的 currentDeck 读(站位不再读),卡面(头像/名字/稀有度)用同一份 CharacterData 刷新(新增 HeroCardUI.SetCharacterInfo,区别于绑定单位的 SetHero),否则会出现「卡面显示人类士兵、拖出来却是法师」的不一致;PlayerData 读不到时兜底用 HeroRoster。注意 CharacterData 里有些角色(荒野之王/荒野流寇等)unitPrefab 为空,不能出战,取阵容时要跳过。 +- [2026-10-04 23:19:03] - [2026-10-04 22:20:00] CharacterData 真实字段名(猜错会导致 exec_editor_script 编译失败):baseMaxHealth / baseAttackPower / baseMoveSpeed / healthPerLevel / attackPerLevel / moveSpeedPerLevel / characterId / characterName / cardIcon / rarity / unitPrefab / description。**不存在** baseHealth / baseAttack。UnitBase 的“角色数据”字段是字符串 characterDataName,运行时 Resources.Load($"Data/{name}"),资产放在 Assets/Resources/Data。 +- [2026-10-04 23:19:03] - [2026-10-04 22:20:00] 批量改 prefab 上 UnitBase.characterDataName 的坑:AssetDatabase.FindAssets("名称 t:Prefab") 是模糊匹配(搜“盾卫”会命中“城堡金盾卫”),曾把城堡金盾卫误填成 盾卫Data(HP 700 顶替了 300)。**How to apply:** 批量改 prefab 字段必须用精确路径 AssetDatabase.LoadAssetAtPath(完整路径) 逐个处理,改完立刻回读全量校验,不能只看“Updated N”日志。 +- [2026-10-04 23:19:03] - [2026-10-04 22:20:00] 第一章/第二章 共 12 个角色 prefab 的 characterDataName 已补齐并验证可加载(数值取自 Resources/Data)。映射留意:狼人.prefab 对应的是 狂暴狼人Data(资产名与文件不一致)。**未完成项:** 蓝角蛮卒.prefab 填的 蓝角蛮卒Data 在 Resources/Data 下不存在,运行时会打黄色警告并回退 Inspector 默认值 —— 待用户提供 HP/ATK/SPD 等数值或指定复用来源后再新建该资产。 +- [2026-10-04 23:19:03] - [2026-10-04 22:20:00] exec_editor_script 参数规则(当前 Codely bridge 版本):enable_repl=false 时**不能**传 script_session_id,否则报 “was provided but enable_repl is false” 校验失败且脚本完全不执行;空字符串也报错。需要多轮排查就用 enable_repl=true 并复用返回的 session_id。违反会连续重复同一失败调用进而触发 tool loop 检测。 ### Reference - [2026-09-09 12:23:17] 飞行物脚本 Projectile.cs 负责锁敌追踪、碰撞检测和伤害结算。箭矢预制体 ArrowProjectile_White.prefab 已配置 Projectile 组件和 CapsuleCollider(Is Trigger)。远程单位需在攻击动画松弦帧添加 OnAttackEffect Event,并在 UnitBase 中设置 attackType=RangedProjectile、projectilePrefab、projectileSpawnPoint。